我使用optparse-applicative与stackage lts 5.1 我有一个解析器与子命令,我已经描述了他们的选项的帮助文本,但他们不显示。optparse-applicative子命令帮助文本
这是输出当我--help
运行可执行文件:
[[email protected] 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
代码:
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
你确实试过' --help',对不对? –
Zeta
当然,问题中的输出是正确的。我将编辑,以便更清楚 –
您已经尝试过'manipro --help'。请注意,我询问您是否尝试过'manipro --help',例如, '操作导出 - 帮助'。 –
Zeta