aboutsummaryrefslogtreecommitdiff
path: root/Command.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-07-08 13:39:11 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-07-08 13:39:11 -0400
commit8879c96d157f06bbd2372064251676b7927ce38e (patch)
tree146672a064a12c92cb692dc3a8293d2dd48afe22 /Command.hs
parente73914b7950ce9d26a3882472c7ab27260ff87f9 (diff)
display cmdparamdesc in optparse-applicative usage messages
Since optparse-applicative display "FOO" as "[FOO]", the paramOptional modifier which wrapped it in square brackets was removed from most places.
Diffstat (limited to 'Command.hs')
-rw-r--r--Command.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/Command.hs b/Command.hs
index 6522924c3..4fc665ba2 100644
--- a/Command.hs
+++ b/Command.hs
@@ -36,13 +36,17 @@ import CmdLine.GitAnnex.Options as ReExported
import qualified Options.Applicative as O
{- Generates a normal Command -}
-command :: String -> String -> CommandSection -> String -> CommandParser -> Command
-command = Command [] Nothing commonChecks False False
+command :: String -> String -> CommandSection -> String -> (Command -> CommandParser) -> Command
+command name paramdesc section desc parser = c
+ where
+ c = Command [] Nothing commonChecks False False name paramdesc section desc (parser c)
{- Simple CommandParser generator, for when the CommandSeek wants all
- non-option parameters. -}
-commandParser :: (CmdParams -> CommandSeek) -> CommandParser
-commandParser mkseek = mkseek <$> O.many (O.argument O.str O.idm)
+commandParser :: (CmdParams -> CommandSeek) -> Command -> CommandParser
+commandParser mkseek c = mkseek <$> O.many cmdparams
+ where
+ cmdparams = O.argument O.str (O.metavar (cmdparamdesc c))
{- Indicates that a command doesn't need to commit any changes to
- the git-annex branch. -}