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.
This commit is contained in:
Joey Hess 2015-07-08 13:39:11 -04:00
parent a2ba701056
commit 3125da54f6
7 changed files with 15 additions and 11 deletions

View file

@ -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. -}