paul j3 added the comment:
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}
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29030>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com