Steven Bethard <steven.beth...@gmail.com> added the comment:

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.

----------
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python
stage:  -> needs patch
versions: +Python 3.3 -Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9694>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to