summaryrefslogtreecommitdiff
path: root/src/Command.hs
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-05-08 02:09:04 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2016-05-08 02:09:04 +0200
commite66d94505776ec13259bedde4e5342985322a482 (patch)
tree9588170ad92276e2d0e6ef254dc603c880fa7264 /src/Command.hs
parent6ce5de5a227267e359aa3c38344e3858f035287d (diff)
download2017-01-16_17:13:37-master.tar
2017-01-16_17:13:37-master.tar.gz
2017-01-16_17:13:37-master.tar.bz2
2017-01-16_17:13:37-master.tar.xz
2017-01-16_17:13:37-master.zip
Feature completionHEADmaster
Diffstat (limited to 'src/Command.hs')
-rw-r--r--src/Command.hs7
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
20import Data.Maybe (fromMaybe) 20import Data.Maybe (fromMaybe)
21 21
22import Data.CaseInsensitive ( CI )
23import qualified Data.CaseInsensitive as CI
24
22import Types 25import Types
23 26
24data Cmd = PerformAlt Alteration Comment 27data Cmd = PerformAlt Alteration Comment
@@ -85,7 +88,7 @@ parseCmd' args = do
85 88
86cmdParser :: Maybe Entity -> Parser Cmd 89cmdParser :: Maybe Entity -> Parser Cmd
87cmdParser tip = hsubparser $ mconcat [ command "quit" $ pure Quit `info` progDesc "Exit gracefully" 90cmdParser 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")