aboutsummaryrefslogtreecommitdiffstats
path: root/app/Main.hs
blob: e3c1a28ef585f3b9484d98196562abdf27eec58b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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 = do
  options <- O.execParser (O.info (commandParser <**> O.helper) O.idm)
  print options