* small colouriser tool to run .hs files through HsColour

This commit is contained in:
Vincent Ambo 2012-03-25 19:01:56 +02:00
parent 7f4761bf7c
commit 74ce7d9bf0
3 changed files with 88 additions and 0 deletions

View file

@ -0,0 +1,21 @@
{-# LANGUAGE TemplateHaskell #-}
import Control.Monad (unless)
import Language.Haskell.HsColour.Colourise (defaultColourPrefs)
import Language.Haskell.HsColour.CSS
import Options
defineOptions "MainOptions" $ do
stringOption "optFile" "file" ""
"Name of the .hs file. Will be used for the HTML file as well"
colorCode :: String -> String -> IO ()
colorCode input output = do
code <- readFile input
writeFile output $ hscolour False code
main :: IO ()
main = runCommand $ \opts args -> do
let file = optFile opts
unless (file == "") $
colorCode (file ++ ".hs") (file ++ ".html")