[issue9341] allow argparse subcommands to be grouped
paul j3
report at bugs.python.org
Sun Jun 22 21:37:06 CEST 2014
paul j3 added the comment:
This patch accomplishes this task by adding a _PseudoGroup class to _SubParsersAction. It's like the _ChoicesPseudoAction except that it maintains its own _choices_actions list.
It takes advantage of the fact that formatter._format_actions is recursive when it comes to actions in _choices_actions. In fact it is possible to define groups within groups (not that I would recommend that).
There is one simple test case in test_argparse, similar to the example in this issue.
----------
keywords: +patch
Added file: http://bugs.python.org/file35733/issue9341_1.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9341>
_______________________________________
More information about the Python-bugs-list
mailing list