summaryrefslogtreecommitdiff
path: root/Coolbal/Options.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2021-07-11 17:56:34 +0200
committerTom Smeding <tom@tomsmeding.com>2021-07-11 17:56:34 +0200
commitf57e800a1d1a8e9f2bed34428f7f58a375f178fb (patch)
tree7164b0a9bcf03703a6a7f44f5fa04e5847d876e5 /Coolbal/Options.hs
parent317f1e27688a082926f39ec897f5a38d01a07ce7 (diff)
WIP splitting of Target module and towards parallel buildsHEADmaster
Diffstat (limited to 'Coolbal/Options.hs')
-rw-r--r--Coolbal/Options.hs29
1 files changed, 27 insertions, 2 deletions
diff --git a/Coolbal/Options.hs b/Coolbal/Options.hs
index 7901386..bd3fdd3 100644
--- a/Coolbal/Options.hs
+++ b/Coolbal/Options.hs
@@ -1,14 +1,29 @@
module Coolbal.Options (
Options(..),
+ Flags(..),
+ Command(..),
BuildOptions(..),
RunOptions(..),
optionParser,
+
+ -- * Re-exports
+ Verbosity(..),
) where
import Options.Applicative
+import Coolbal.Verbosity
+
+
+data Options = Options Flags Command
+ deriving (Show)
+
+data Flags = Flags
+ { fVerbosity :: Verbosity
+ }
+ deriving (Show)
-data Options
+data Command
= Build BuildOptions
| Rebuild BuildOptions
| Clean
@@ -35,7 +50,17 @@ optionParser =
\result.")
root :: Parser Options
-root =
+root = Options <$> parseFlags <*> parseCommand
+
+parseFlags :: Parser Flags
+parseFlags = Flags
+ <$> intToVerbosity . length <$> many
+ (flag' () (long "verbose"
+ <> short 'v'
+ <> help "Verbosity (pass multiple times to increase level)"))
+
+parseCommand :: Parser Command
+parseCommand =
hsubparser (
command "build" (info (Build <$> buildOptions)
(progDesc "Build the project"))