mirror of
https://github.com/ilyakooo0/optparse-applicative.git
synced 2024-11-22 22:18:13 +03:00
Concatenate subparser help texts vertically (fixes #93).
This commit is contained in:
parent
dc5ba49b05
commit
5c602d9631
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
8
tests/subparsers.err.txt
Normal 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
|
Loading…
Reference in New Issue
Block a user