I'm using optparse-applicative that comes with stackage lts 5.1 I have a parser with subcommands and I have described a help text for their options, but they don't show.
This is the output when I run the executable with --help
:
[david@devcentos65 manipro]$ /home/david/.local/bin/manipro --help
manipro - text1
Usage: manipro COMMAND [-v|--verbose] text2
Available options:
-h,--help Show this help text
-v,--verbose text3
Available commands:
export text4
dico text9
The code :
parserArgs :: ParserInfo ArgApp
parserArgs = info (helper <*> args) desc
where
desc =
fullDesc <>
progDesc "text1" <>
header "text2"
args = ArgApp <$> argCmd <*> optverbose
where
optverbose = switch (
short 'v' <> long "verbose" <>
help "text3" )
argCmd = subparser (argCmdExport <> argCmdDico)
argCmdExport = command "export" infos
where
infos = info options desc
desc = progDesc "text4"
options = ArgCmdExport <$>
argModeExport <*>
argTableExport <*>
argOptExport
argModeExport = argument auto (metavar "FORMAT")
argTableExport = argument text (metavar "TABLE")
argOptExport = ArgOptExport <$> optional noesc <*> optional cols <*>
ens <*> tst
where
noesc = option textList (long "noesc" <> metavar "CHAMPS" <> help "text5" )
cols = option textList (long "cols" <> metavar "CHAMPS" <> help "text6" )
ens = flag EnsEtoile EnsDollar (short 'd' <> long "dollar" <>
help "text7")
tst = flag False True (short 't' <> long "test" <>
help "text8")
argCmdDico = command "dico" infos
where
infos = info options desc
desc = progDesc "text9"
options = ArgCmdDico <$>
argOptDico
argOptDico = ArgOptDico <$> optional tables
where
tables = option textList (long "tables" <> metavar "TABLES" <>
help "text10" )
text = str >>= return . pack
textList = str >>= return . splitOn "," . pack