[New-bugs-announce] [issue15327] Argparse: main arguments and subparser arguments indistinguishable
Ingo Fischer
report at bugs.python.org
Wed Jul 11 13:05:30 CEST 2012
New submission from Ingo Fischer <fredistdurstig at googlemail.com>:
I have an argument called '--verbose' in the main parser.
Then I add a subparser called 'command', to which I add an argument with the same name '--verbose' (See attached script).
When I process these args, I cannot decide afterwards if the user called 'myscript --verbose command' or 'myscript command --verbose'. I always get the same Namespace object returned from parse_args.
IMHO the Namespace object should also provide informations about the source parser, to make main parser args and subparser args distinguishable. Also if I call 'myscript --verbose command --verbose', I should get both args in the resulting Namespace object.
----------
components: Library (Lib)
files: argparsetest.py
messages: 165248
nosy: Ingo.Fischer
priority: normal
severity: normal
status: open
title: Argparse: main arguments and subparser arguments indistinguishable
type: enhancement
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file26356/argparsetest.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15327>
_______________________________________
More information about the New-bugs-announce
mailing list