Message115059
And I guess the bigger issue to think about is how to add this in a backwards compatible way. I guess we could just add methods like "set_positionals_group_name(name)" and then fiddle with "self._positionals.title" in there. Not sure that's a great solution though - it seems like adding one method to change just this single attribute is overkill and not very general.
In the meantime, here's a workaround:
>>> parser = argparse.ArgumentParser(prog='PROG')
>>> parser.add_argument('--foo', required=True)
>>> parser._optionals.title = "flag arguments"
>>> parser.print_help()
usage: PROG [-h] --foo FOO
flag arguments:
-h, --help show this help message and exit
--foo FOO
I can't promise this will continue to work, since it uses the undocumented _optionals attribute, but at least it's a way of getting something like what you want now. |
|
Date |
User |
Action |
Args |
2010-08-27 08:57:06 | bethard | set | recipients:
+ bethard, eric.smith, r.david.murray, benschmaus |
2010-08-27 08:57:06 | bethard | set | messageid: <1282899426.18.0.731602333018.issue9694@psf.upfronthosting.co.za> |
2010-08-27 08:57:05 | bethard | link | issue9694 messages |
2010-08-27 08:57:04 | bethard | create | |
|