[issue9653] New default argparse output to be added

Tom Browder report at bugs.python.org
Mon Aug 23 13:08:50 CEST 2010


Tom Browder <tom.browder at gmail.com> added the comment:

On Sun, Aug 22, 2010 at 17:06, Steven Bethard <report at bugs.python.org> wrote:
...
> import argparse
> import sys
>
> parser = argparse.ArgumentParser()
> parser.add_argument('--foo')
>
> if len(sys.argv) == 1:
>    parser.print_help()
> else:
>    print(parser.parse_args())

Of course that works, but I want to be able to customize the parser so
it shows something like:

  Usage: <program name> [options]
  Use option '-h' for help.

Two problems for me with current behavior:

1.   "usage" and "optional" => not capitalized

2.   usage: temp.py [-h] [--foo FOO] => gets very lengthy and mind
numbing for programs with lots of options

Regards,

-Tom

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9653>
_______________________________________


More information about the Python-bugs-list mailing list