diff options
Diffstat (limited to 'src/Command.hs')
-rw-r--r-- | src/Command.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Command.hs b/src/Command.hs index 659d14d..127e986 100644 --- a/src/Command.hs +++ b/src/Command.hs | |||
@@ -19,6 +19,9 @@ import qualified Data.Text as Text | |||
19 | 19 | ||
20 | import Data.Maybe (fromMaybe) | 20 | import Data.Maybe (fromMaybe) |
21 | 21 | ||
22 | import Data.CaseInsensitive ( CI ) | ||
23 | import qualified Data.CaseInsensitive as CI | ||
24 | |||
22 | import Types | 25 | import Types |
23 | 26 | ||
24 | data Cmd = PerformAlt Alteration Comment | 27 | data Cmd = PerformAlt Alteration Comment |
@@ -85,7 +88,7 @@ parseCmd' args = do | |||
85 | 88 | ||
86 | cmdParser :: Maybe Entity -> Parser Cmd | 89 | cmdParser :: Maybe Entity -> Parser Cmd |
87 | cmdParser tip = hsubparser $ mconcat [ command "quit" $ pure Quit `info` progDesc "Exit gracefully" | 90 | cmdParser tip = hsubparser $ mconcat [ command "quit" $ pure Quit `info` progDesc "Exit gracefully" |
88 | , command "dump" $ pure Dump `info` progDesc "Print all internal state in a format not necessarily human readable" | 91 | , command "list" $ pure Dump `info` progDesc "Print a list of tracked entities" |
89 | , command "history" $ parseHistory `info` progDesc "Print an excerpt of combat history" | 92 | , command "history" $ parseHistory `info` progDesc "Print an excerpt of combat history" |
90 | , command "who" $ pure ShowTip `info` progDesc "Who’s turn is it?" | 93 | , command "who" $ pure ShowTip `info` progDesc "Who’s turn is it?" |
91 | , command "set" $ parseOverride `info` progDesc "Set an entities sequence value" | 94 | , command "set" $ parseOverride `info` progDesc "Set an entities sequence value" |
@@ -116,7 +119,7 @@ cmdParser tip = hsubparser $ mconcat [ command "quit" $ pure Quit `info` progDes | |||
116 | entity | 119 | entity |
117 | | (Just tip') <- tip = fromMaybe tip' <$> optional entity' | 120 | | (Just tip') <- tip = fromMaybe tip' <$> optional entity' |
118 | | otherwise = entity' | 121 | | otherwise = entity' |
119 | entity' = Entity <$> (Text.pack <$> strArgument (help "Name of the target entity" <> metavar "NAME")) <*> optional (argument positive $ help "Number of the target entity" <> metavar "NUMBER") | 122 | entity' = Entity <$> (CI.mk . Text.pack <$> strArgument (help "Name of the target entity" <> metavar "NAME")) <*> optional (option positive $ long "number" <> short 'n' <> help "Number of the target entity" <> metavar "NUMBER") |
120 | 123 | ||
121 | sequenceValue = argument auto (help "Sequence value adjustment" <> metavar "SEQUENCE") | 124 | sequenceValue = argument auto (help "Sequence value adjustment" <> metavar "SEQUENCE") |
122 | sequenceValue' = argument auto (help "Sequence value" <> metavar "SEQUENCE") | 125 | sequenceValue' = argument auto (help "Sequence value" <> metavar "SEQUENCE") |