summaryrefslogtreecommitdiff
path: root/Coolbal/Options.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Coolbal/Options.hs')
-rw-r--r--Coolbal/Options.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/Coolbal/Options.hs b/Coolbal/Options.hs
index 35b774c..8b1f807 100644
--- a/Coolbal/Options.hs
+++ b/Coolbal/Options.hs
@@ -1,6 +1,7 @@
module Coolbal.Options (
Options(..),
BuildOptions(..),
+ RunOptions(..),
optionParser,
) where
@@ -11,11 +12,15 @@ data Options
= Build BuildOptions
| Clean
| Configure
+ | Run RunOptions
deriving (Show)
data BuildOptions = BuildOptions (Maybe String)
deriving (Show)
+data RunOptions = RunOptions (Maybe String) [String]
+ deriving (Show)
+
optionParser :: ParserInfo Options
optionParser =
info (root <**> helper)
@@ -33,6 +38,8 @@ root =
hsubparser (
command "build" (info (Build <$> buildOptions)
(progDesc "Build the project"))
+ <> command "run" (info (Run <$> runOptions)
+ (progDesc "Run an executable from the project"))
<> command "clean" (info (pure Clean)
(progDesc "Clean coolbal's files for this project"))
<> command "configure" (info (pure Configure)
@@ -40,3 +47,6 @@ root =
buildOptions :: Parser BuildOptions
buildOptions = BuildOptions <$> optional (argument str (metavar "TARGET"))
+
+runOptions :: Parser RunOptions
+runOptions = RunOptions <$> optional (argument str (metavar "TARGET")) <*> many (argument str (metavar "ARGS..."))