mirror of
https://github.com/ilyakooo0/optparse-applicative.git
synced 2024-11-22 22:18:13 +03:00
Ensure alternative subparsers don't carry each others contexts.
This commit is contained in:
parent
5b48577aa5
commit
450e7c3f70
@ -190,6 +190,15 @@ case_drops_back_contexts = do
|
||||
i = info (p0 <**> helper) idm
|
||||
checkHelpTextWith (ExitFailure 1) defaultPrefs "dropback" i ["b", "-aA"]
|
||||
|
||||
case_context_carry :: Assertion
|
||||
case_context_carry = do
|
||||
let p3 = strOption (short 'a' <> metavar "A")
|
||||
p2 = subparser (command "b" (info p3 idm) <> metavar "B")
|
||||
p1 = subparser (command "c" (info p3 idm) <> metavar "C")
|
||||
p0 = (,) <$> p2 <*> p1
|
||||
i = info (p0 <**> helper) idm
|
||||
checkHelpTextWith (ExitFailure 1) defaultPrefs "carry" i ["b", "-aA", "c"]
|
||||
|
||||
case_many_args :: Assertion
|
||||
case_many_args = do
|
||||
let p = many (argument str idm)
|
||||
|
3
tests/carry.err.txt
Normal file
3
tests/carry.err.txt
Normal file
@ -0,0 +1,3 @@
|
||||
Missing: -a A
|
||||
|
||||
Usage: carry c -a A
|
Loading…
Reference in New Issue
Block a user