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 louielu
Recipients caveman, eric.smith, louielu
Date 2017-10-12.04:11:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1507781492.49.0.213398074469.issue31768@psf.upfronthosting.co.za>
In-reply-to
Content
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'])
History
Date User Action Args
2017-10-12 04:11:32louielusetrecipients: + louielu, eric.smith, caveman
2017-10-12 04:11:32louielusetmessageid: <1507781492.49.0.213398074469.issue31768@psf.upfronthosting.co.za>
2017-10-12 04:11:32louielulinkissue31768 messages
2017-10-12 04:11:32louielucreate