summaryrefslogtreecommitdiff
path: root/src/Main.hs
blob: 1b4996f693d9dbc373a86b4479a3704c6699d4e1 (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
40
41
42
43
44
import Options.Applicative
import Game (Game(..), Setup(..), beginGame)

setup :: Parser Setup
setup = Setup
        <$> option auto
            (  short 'n'
            <> long "player-number"
            <> metavar "n"
            <> value 4
            <> help "n players, n must be larger than 2 (default: 4)"
            )
        <*> option auto
            (  short 'r'
            <> long "rounds"
            <> metavar "r"
            <> value 1
            <> help "play r rounds, r must be at least 1 (default: 1)"
            )
        <*> option auto
            (  short 'd'
            <> long "decks"
            <> metavar "d"
            <> value 2
            <> help "use d decks 52 cards each, d must be at least 2 (default: 2)"
            )
        <*> option auto
            (  short 'c'
            <> long "initial-cards"
            <> metavar "c"
            <> value 5
            <> help "deal c cards per player, c must be at least 2 (default: 5)"
            )
        <*> switch
            (  short 'a'
            <> long "auto"
            <> help "run in demo mode"
            )

main :: IO ()
main = do
    let opts = info (setup <**> helper) (fullDesc <> progDesc "One Card")
    beginGame =<< execParser opts
    return ()