Newer
Older
#!/usr/bin/env -S runhaskell --ghc-arg="-Wall" --ghc-arg="-i lib"
{-# LANGUAGE OverloadedStrings #-}
import Data.Text (Text, lines, unlines)
import Data.Text.IO (interact)
import Prelude hiding (interact, lines, unlines)
import System.Environment (getArgs)
import System.Script (syntax)
wrap :: [Text] -> [Text]
wrap text = "<body>": (("\t"<>) <$> text) ++ ["</body>"]
main :: IO ()
main = getArgs >>= run
where
run ["-"] = interact (unlines . wrap . lines)
run [target] = xargs (pure.wrap) target
run _ = syntax "TARGET_DIRECTORY"