diff options
Diffstat (limited to 'Biz/Bild.hs')
-rw-r--r-- | Biz/Bild.hs | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs index 81ab44f..4f3a186 100644 --- a/Biz/Bild.hs +++ b/Biz/Bild.hs @@ -1,5 +1,6 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE NoImplicitPrelude #-} @@ -118,9 +119,9 @@ import qualified Data.Char as Char import qualified Data.List as List import qualified Data.String as String import qualified Data.Text as Text +import qualified System.Console.Docopt as Docopt import qualified System.Directory as Dir import qualified System.Environment as Env -import qualified System.Exit as Exit import System.FilePath ((</>)) import qualified System.FilePath as File import qualified System.Process as Process @@ -128,10 +129,23 @@ import qualified Text.Regex.Applicative as Regex import qualified Prelude main :: IO () -main = - Env.getArgs /> head >>= \case - Nothing -> Exit.die "usage: bild <target>" - Just target -> analyze target >>= build +main = Env.getArgs >>= Docopt.parseArgsOrExit help >>= run + where + run args = + Docopt.getAllArgs args (Docopt.argument "target") + |> mapM_ (\target -> analyze target >>= build) + +help :: Docopt.Docopt +help = + [Docopt.docopt| +bild + +Usage: + bild <target>... + +Options: + -v, --verbose Show output from underlying compiler +|] data Ext = Hs | Scm | Nix deriving (Show) |