From f57e800a1d1a8e9f2bed34428f7f58a375f178fb Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 11 Jul 2021 17:56:34 +0200 Subject: WIP splitting of Target module and towards parallel builds --- Coolbal/Options.hs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'Coolbal/Options.hs') 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")) -- cgit v1.2.3-70-g09d2