This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年02月16日 23:46 by ncoghlan, last changed 2022年04月11日 14:57 by admin.
| Messages (2) | |||
|---|---|---|---|
| msg153514 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2012年02月16日 23:46 | |
I've just started using the argparse subparser feature, and it's very nice. However, I'd love to be able to group the different subparser commands into different sections the way I can group ordinary arguments with add_argument_group(). Initially I thought just calling "parser.add_subparsers()" multiple times with different "title" values would work, but argparse doesn't currently like that - it errors out with "cannot have multiple subparser arguments". I propose that instead of treating this case as an error, argparse should treat it as a way for defining subparser groups - there would still only be a single subparser argument accepted, but the individual commands would appear grouped appropriately in the help output. |
|||
| msg153517 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2012年02月16日 23:54 | |
I realised that my initial idea doesn't play nicely with my other suggestion of allowing a "metavar" argument to add_subparsers() (see #14039). A better model may be to mimic the add_argument_group() directly by offering an add_parser_group() method on the subparser management object. This would allow ungrouped commands to be presented first, with grouped commands following under their own headings. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:26 | admin | set | github: 58245 |
| 2013年01月30日 01:27:56 | chris.jerdonek | set | nosy:
+ chris.jerdonek |
| 2013年01月30日 00:27:19 | toszter | set | nosy:
+ toszter |
| 2012年02月16日 23:54:55 | ncoghlan | set | messages: + msg153517 |
| 2012年02月16日 23:46:45 | ncoghlan | create | |