Skip to content
Snippets Groups Projects
reroot.hs 576 B
Newer Older
#!/usr/bin/env -S runhaskell --ghc-arg="-Wall" --ghc-arg="-i lib"
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)
import Text.Filter (xargs)

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