Louie Lu <[email protected]> added the comment:
the format of usage is do at argparse.py:296.
So how do we format this kind of situation,
to be like this, if the group also too long?
usage: test.py [-h]
[-v | -q | -x [X] | -y [Y] | Z | Z | Z | Z | Z |
Z | Z | Z]
Also, another bug I think is, given two mutul group,
it will not show out the correct grouping:
usage: test.py [-h] [-v] [-e] [Z] [G] [Z] [G]
positional arguments:
Z the exponent
G the exponent
Z the exponent
G the exponent
optional arguments:
-h, --help show this help message and exit
-v, --verbose
-e, --eeeeee
--- 2 mutul group ---
import sys
import argparse
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group()
group.add_argument("-v", "--verbose", action="store_true")
g2 = parser.add_mutually_exclusive_group()
g2.add_argument("-e", "--eplog", action="store_true")
g2.add_argument("-g", "--quiet", action="store_true")
for i in range(int(sys.argv[1])):
group.add_argument("z", metavar='Z', type=str, help="the exponent",
nargs='?')
g2.add_argument("z", metavar='Z', type=str, help="the exponent", nargs='?')
parser.parse_args(['-h'])
----------
nosy: +louielu
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue31768>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com