summaryrefslogtreecommitdiff
path: root/Coolbal/Options.hs
diff options
context:
space:
mode:
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"))