Message304202
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']) |
|
Date |
User |
Action |
Args |
2017-10-12 04:11:32 | louielu | set | recipients:
+ louielu, eric.smith, caveman |
2017-10-12 04:11:32 | louielu | set | messageid: <1507781492.49.0.213398074469.issue31768@psf.upfronthosting.co.za> |
2017-10-12 04:11:32 | louielu | link | issue31768 messages |
2017-10-12 04:11:32 | louielu | create | |
|