Message211132
| Author |
paul.j3 |
| Recipients |
Martin.d'Anjou, benschmaus, bethard, docs@python, eric.araujo, eric.smith, martin.panter, mburger, paul.j3, r.david.murray, rhettinger, terry.reedy, tshepang |
| Date |
2014年02月13日.08:34:37 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1392280478.24.0.220493298591.issue9694@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The attached file shows how the default argument groups could be redefined, using 'required' as the criteria.
I've implemented it as a method that is added to a subclass of ArgumentParser. This method is invoked after arguments are defined, prior to generating the help.
The help looks something like this:
usage: alt_grouping.py [-h] [-f FOO] -g GOO pos [baz]
required:
pos required positional
-g GOO, --goo GOO required optional
optional:
-h, --help show this help message and exit
-f FOO, --foo FOO optional
baz optional positional
I was thinking of implementing this as a formatter subclass, but given the way the help is assembled, invoking this method from the parser is simpler. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年02月13日 08:34:38 | paul.j3 | set | recipients:
+ paul.j3, rhettinger, terry.reedy, bethard, eric.smith, eric.araujo, r.david.murray, docs@python, benschmaus, tshepang, martin.panter, mburger, Martin.d'Anjou |
| 2014年02月13日 08:34:38 | paul.j3 | set | messageid: <1392280478.24.0.220493298591.issue9694@psf.upfronthosting.co.za> |
| 2014年02月13日 08:34:38 | paul.j3 | link | issue9694 messages |
| 2014年02月13日 08:34:37 | paul.j3 | create |
|