Changes by Vasilis Vasaitis vvasai...@gmail.com:
--
nosy: +vvas
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14074
___
___
Python-bugs-list
paul j3 added the comment:
This patch fixes both help and error formatting.
A module level '_format_metavars' does the formatting for both.
I have tried several alternatives, including using the 'usage' style.
There is similarity between this fix and that for issue 16468 (custom choices),
paul j3 added the comment:
oops - to fix the error message that OP complained about, I need to patch
'_get_action_name' as well:
def _get_action_name(argument):
...
elif argument.metavar not in (None, SUPPRESS):
metavar = argument.metavar
if
Changes by paul j3 ajipa...@gmail.com:
--
nosy: +paul.j3
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14074
___
___
Python-bugs-list mailing list
paul j3 added the comment:
This patch fixes the problem by joining the metavar terms with '|'. So the
help for the test case (adapted from an existing tuple test) looks like:
usage: PROG [-h] W1 [W2 ...] [X1 [X2 ...]] Y1 Y2 Y3 [Z1]
positional arguments:
W1|W2 w
X1|X2
Steven Bethard steven.beth...@gmail.com added the comment:
Looks like the problem is that _format_action_invocation is not being as
careful with the different possibilities for metavar as _format_args is.
Patches welcome!
--
___
Python tracker
Changes by Tshepang Lekhonkhobe tshep...@gmail.com:
--
title: argparse does not allow nargs1 for positional arguments but doesn't
allow metavar to be a tuple - argparse allows nargs1 for positional arguments
but doesn't allow metavar to be a tuple