from .base import DebugArghParser, run
"""Issue #12: @command was broken if there were more than one argument
"""Issue #27: store_true is not set for inferred bool argument.
- Reason: when @command was refactored, it stopped using @arg, but it is
+ Reason: when @command was refactored, it stopped using @arg, but it is
it was there that guesses (choices→type, default→type and
default→action) were made.
# default → action (store_true)
assert run(p, 'parrot') == 'beautiful plumage\n'
assert run(p, 'parrot --dead') == 'this parrot is no more\n'
+ """ Issue #31: Argh fails with parameter action type 'count' if a default
+ :Reason: assembling._guess() would infer type from default value without
+ regard to the action. _CountAction does not accept argument "type".
+ :Solution: restricted type inferring to actions "store" and "append".
+ @argh.arg('-v', '--verbose', dest='verbose', action='count', default=0)
+ yield kwargs.get('verbose', -1)
+ assert '0\n' == run(p, '')
+ assert '1\n' == run(p, '-v')
+ assert '2\n' == run(p, '-vv')