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.
Created on 2010年08月20日 20:56 by Tom.Browder, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| python-v2.7-argparser-patch.txt | Tom.Browder, 2010年08月20日 20:56 | Proposed patch for Python 2.7 | ||
| Messages (5) | |||
|---|---|---|---|
| msg114455 - (view) | Author: Tom Browder (Tom.Browder) | Date: 2010年08月20日 20:56 | |
I would like to be able to change argparse default strings so the first word is capitalized. In lieu of that, I propose the attached patch to 2.7 which changes them in the source code. |
|||
| msg115082 - (view) | Author: Steven Bethard (bethard) * (Python committer) | Date: 2010年08月27日 14:27 | |
Looks like "usage" is almost always lowercase in the programs I tried (ssh, svn, cat, etc.). So it probably wouldn't be a good idea to change the default. Seems like both this and issue 9694 need a better way to customize the text in argparse mesages. As a temporary workaround for the group names, you can try: parser._optionals.title = "Optional arguments" parser._positionals.title = "Positional arguments" I can't guarantee this will continue to work since it relies on internal details but at least it would work for the time being. |
|||
| msg115108 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2010年08月27日 18:14 | |
2.7 is closed to new features and I cannot see making a non-bug change in a maintenance release that could break something. Should this be closed in favor of #9694? (Or vice versa?). Perhaps one of the issues should be renamed something like "Improve argparse message customization". |
|||
| msg115126 - (view) | Author: Tom Browder (Tom.Browder) | Date: 2010年08月27日 20:08 | |
... > Should this be closed in favor of #9694? (Or vice versa?). Perhaps one of the issues should be renamed something like "Improve argparse message customization". That sounds like a winner to me -Tom |
|||
| msg132325 - (view) | Author: Steven Bethard (bethard) * (Python committer) | Date: 2011年03月27日 14:09 | |
I'm moving this over to Issue 11695, which proposes support for a usage/help message template. To customize the argument group names, the recommended approach is to create your own argument groups, and only put arguments there, e.g.: parser = argparse.ArgumentParser(add_help=False) flags = parser.add_argument_group('My Optional Arguments') flags.add_argument('-h', '--help', action='help') flags.add_argument('-v', action='version', version='1.3') Then you'll get just the "My Optional Arguments" heading. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:05 | admin | set | github: 53861 |
| 2011年03月27日 14:09:31 | bethard | set | status: open -> closed resolution: duplicate messages: + msg132325 superseder: Improve argparse usage/help customization stage: test needed -> resolved |
| 2010年08月27日 21:30:25 | r.david.murray | set | title: Tidy argparse default output -> Enhance argparse help output customizability |
| 2010年08月27日 20:08:30 | Tom.Browder | set | messages:
+ msg115126 title: Enhance argparse help output customizability -> Tidy argparse default output |
| 2010年08月27日 19:16:55 | r.david.murray | set | nosy:
+ r.david.murray |
| 2010年08月27日 19:16:39 | r.david.murray | set | title: Tidy argparse default output -> Enhance argparse help output customizability |
| 2010年08月27日 18:14:10 | terry.reedy | set | versions:
+ Python 3.2, - Python 2.7 nosy: + terry.reedy messages: + msg115108 stage: test needed |
| 2010年08月27日 14:27:25 | bethard | set | messages: + msg115082 |
| 2010年08月27日 12:46:13 | r.david.murray | set | nosy:
+ bethard |
| 2010年08月20日 20:56:57 | Tom.Browder | create | |