Concatenate subparser help texts vertically (fixes #93).

This commit is contained in:
Paolo Capriotti 2014-07-23 16:09:29 +01:00
parent dc5ba49b05
commit 5c602d9631
4 changed files with 23 additions and 1 deletions

View File

@ -4,6 +4,9 @@
- Added low-level function to handle parse results (pull request \#94).
- Fixed bugs
* \#93 - Formatting problem for several sub-parsers
## Version 0.9.0 (23 May 2014)
- The option returned by `abortOption` is now visible by default.

View File

@ -61,7 +61,7 @@ optDesc pprefs style info opt =
-- | Generate descriptions for commands.
cmdDesc :: Parser a -> Chunk Doc
cmdDesc = mconcat . mapParser desc
cmdDesc = vcatChunks . mapParser desc
where
desc _ opt =
case optMain opt of

View File

@ -403,6 +403,17 @@ case_issue_52 = do
let text = head . lines . fst . err $ "test"
"Usage: test FOO" @=? text
case_multiple_subparsers :: Assertion
case_multiple_subparsers = do
let p1 = subparser
(command "add" (info (pure ())
( progDesc "Add a file to the repository" )))
p2 = subparser
(command "commit" (info (pure ())
( progDesc "Record changes to the repository" )))
i = info (p1 *> p2 <**> helper) idm
checkHelpText "subparsers" i ["--help"]
---
deriving instance Arbitrary a => Arbitrary (Chunk a)

8
tests/subparsers.err.txt Normal file
View File

@ -0,0 +1,8 @@
Usage: subparsers COMMAND COMMAND
Available options:
-h,--help Show this help text
Available commands:
add Add a file to the repository
commit Record changes to the repository