aboutsummaryrefslogtreecommitdiffstats
path: root/app/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Main.hs')
-rw-r--r--app/Main.hs37
1 files changed, 36 insertions, 1 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 65ae4a0..e3c1a28 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -1,4 +1,39 @@
module Main where
+import Options.Applicative ((<**>))
+import Options.Applicative qualified as O
+
+data Options = Options
+ { optCommand :: Command
+ }
+ deriving (Show)
+
+data Command
+ = List
+ | Show
+ deriving (Show)
+
+optionsParser :: O.Parser Options
+optionsParser =
+ Options
+ <$> commandParser
+
+commandParser :: O.Parser Command
+commandParser =
+ O.subparser
+ ( O.command "list" (O.info listCommandParser (O.progDesc "List all issues"))
+ <> O.command "show" (O.info showCommandParser (O.progDesc "Show details of all issues"))
+ )
+
+listCommandParser :: O.Parser Command
+listCommandParser =
+ pure List
+
+showCommandParser :: O.Parser Command
+showCommandParser =
+ pure Show
+
main :: IO ()
-main = putStrLn "Hello, Haskell!"
+main = do
+ options <- O.execParser (O.info (commandParser <**> O.helper) O.idm)
+ print options