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 bethard
Recipients benschmaus, bethard, docs@python, eric.araujo, eric.smith, r.david.murray, terry.reedy
Date 2011-03-27.14:20:42
SpamBayes Score 0.00016495219
Marked as misclassified No
Message-id <1301235643.57.0.25546309368.issue9694@psf.upfronthosting.co.za>
In-reply-to
Content
So it strikes me that there already exists an officially supported way to rename your option groups. Just only create your own option groups (never use the default ones) and only put arguments there, e.g.:

------------------------- temp.py --------------------------
parser = argparse.ArgumentParser(description = 'Do something', add_help=False)
flags = parser.add_argument_group('flag arguments')
flags.add_argument('-h', '--help', action='help')
flags.add_argument('--reqarg', '-r', help='This is required', required=True)
flags.add_argument('--optarg','-o', help="This is optional", required=False)
args = parser.parse_args()
------------------------------------------------------------
$ python temp.py --help
usage: temp.py [-h] --reqarg REQARG [--optarg OPTARG]

Do something

flag arguments:
  -h, --help
  --reqarg REQARG, -r REQARG
                        This is required
  --optarg OPTARG, -o OPTARG
                        This is optional
------------------------------------------------------------

The documentation for action='help' needs to be added, as pointed out in Issue# 10772.

So basically, the API for customizing group names is already there. So I'm changing this to a documentation request - there should be an example in the docs showing how to change the default group names as above.
History
Date User Action Args
2011-03-27 14:20:43bethardsetrecipients: + bethard, terry.reedy, eric.smith, eric.araujo, r.david.murray, docs@python, benschmaus
2011-03-27 14:20:43bethardsetmessageid: <1301235643.57.0.25546309368.issue9694@psf.upfronthosting.co.za>
2011-03-27 14:20:43bethardlinkissue9694 messages
2011-03-27 14:20:42bethardcreate