homepage

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.

Author paul.j3
Recipients cykerway, paul.j3, r.david.murray
Date 2017年01月06日.23:49:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483746556.23.0.725870129211.issue29030@psf.upfronthosting.co.za>
In-reply-to
Content
subparsers is an example of choices displaying as the metavar. From the documentation example:
usage: PROG [-h] [--foo] {a,b} ...
positional arguments:
 {a,b} sub-command help
-----------------
To the main parser, the 'subparser' is a positional argument, with an optional 'dest' parameter (default is SUPPRESS), and {a,b} are the choices derived from the define subparser names.
The 'title' and 'description' parameters are used to create an Argument_group.
So any attempt to change how the metavar is created from choices has the potential of changing the subparser display.
That does suggest another formatting option - put your positional argument (with choices) in a custom Argument_Group.
In [658]: p=argparse.ArgumentParser()
In [659]: g=p.add_argument_group(title='lengths')
In [660]: g.add_argument('length',choices=[1,2,3]);
In [661]: p.print_help()
usage: ipython3 [-h] {1,2,3}
optional arguments:
 -h, --help show this help message and exit
lengths:
 {1,2,3}
History
Date User Action Args
2017年01月06日 23:49:16paul.j3setrecipients: + paul.j3, r.david.murray, cykerway
2017年01月06日 23:49:16paul.j3setmessageid: <1483746556.23.0.725870129211.issue29030@psf.upfronthosting.co.za>
2017年01月06日 23:49:16paul.j3linkissue29030 messages
2017年01月06日 23:49:15paul.j3create

AltStyle によって変換されたページ (->オリジナル) /