[Moved from http://code.google.com/p/argparse/issues/detail?id=53] It's currently not possible to have subcommands formatted in groups, e.g. instead of: subcommands: {a,b,c,d,e} a a subcommand help b b subcommand help c c subcommand help d d subcommand help e e subcommand help you should be able to get something like: subcommands: group1: a a subcommand help b b subcommand help c c subcommand help group2: d d subcommand help e e subcommand help
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.