summaryrefslogtreecommitdiff
path: root/Biz/Bild.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-12-05 18:37:53 -0500
committerBen Sima <ben@bsima.me>2020-12-05 18:37:53 -0500
commit00d1489556d28d5e727f207c209163fcd9429084 (patch)
treeb15b590290bb27704b9056777c35f255d012afe1 /Biz/Bild.hs
parent330e4363d8abb509031d2c8c1a89dcc6f955e2c1 (diff)
Bild multiple targets, and use docopt
Diffstat (limited to 'Biz/Bild.hs')
-rw-r--r--Biz/Bild.hs24
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)