summaryrefslogtreecommitdiff
path: root/Biz
diff options
context:
space:
mode:
Diffstat (limited to 'Biz')
-rw-r--r--Biz/Bild.hs24
-rw-r--r--Biz/Bild/Deps/Haskell.nix1
2 files changed, 20 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)
diff --git a/Biz/Bild/Deps/Haskell.nix b/Biz/Bild/Deps/Haskell.nix
index ce75805..5263163 100644
--- a/Biz/Bild/Deps/Haskell.nix
+++ b/Biz/Bild/Deps/Haskell.nix
@@ -11,6 +11,7 @@
"config-ini"
"containers"
"directory"
+ "docopt"
"ekg"
"envy"
"fast-logger"