[issue11174] add argparse formatting option to display type names for metavar

2015-10-19 Thread paul j3

paul j3 added the comment:

This formatter produces an error if one or more of the arguments uses the 
default `None` type (a string).   This is because `None` does not have a 
`.__name__`.

This HelpFormatter probably has been rarely, if ever, used.  The metavar 
parameter works just as well.

--
nosy: +paul.j3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11174] add argparse formatting option to display type names for metavar

2011-03-26 Thread Steven Bethard

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

Sorry about such a slow response on this. Thanks for the patch!

I think rather than adding an ArgumentParser constructor parameter though, we 
should add a new formatter class. The attached patch allows you to write:

parser = argparse.ArgumentParser(
   ... prog='PROG',
   ... formatter_class=argparse.MetavarTypeHelpFormatter)
parser.add_argument('--foo', type=int)
parser.add_argument('bar', type=float)
parser.print_help()
   usage: PROG [-h] [--foo int] float

   positional arguments:
 float

   optional arguments:
 -h, --help  show this help message and exit
 --foo int

What do you think?

--
Added file: http://bugs.python.org/file21407/MetavarTypeHelpFormatter.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11174
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11174] add argparse formatting option to display type names for metavar

2011-03-26 Thread Filip Gruszczyński

Filip Gruszczyński grusz...@gmail.com added the comment:

Well, since you are the designer of the package, I believe you have better 
knowledge on how to extend it :-). I just provided a patch according to what 
you described in the first message. Anyway having separate help formatter seems 
better than bloating parser's constructor.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11174
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11174] add argparse formatting option to display type names for metavar

2011-03-26 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset a15d65d8f269 by Steven Bethard in branch 'default':
Issue #11174: Add argparse.MetavarTypeHelpFormatter, which uses type names
http://hg.python.org/cpython/rev/a15d65d8f269

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11174
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11174] add argparse formatting option to display type names for metavar

2011-03-26 Thread Steven Bethard

Changes by Steven Bethard steven.beth...@gmail.com:


--
assignee:  - bethard
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11174
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11174] add argparse formatting option to display type names for metavar

2011-02-26 Thread Filip Gruszczyński

Filip Gruszczyński grusz...@gmail.com added the comment:

First draft of patch with this functionality. Test, patch and docs are 
included. I'll gladly work further on this, so I would appreciate some advice 
and suggestions.

--
keywords: +patch
nosy: +gruszczy
Added file: http://bugs.python.org/file20919/11174.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11174
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11174] add argparse formatting option to display type names for metavar

2011-02-10 Thread Steven Bethard

New submission from Steven Bethard steven.beth...@gmail.com:

Suggestion from a personal email:

I generally like my command line arguments that take a
value to specify the type, e.g.,

   --runs int  how many runs to do

Naturally I can do this using the metavars argument in every
add_argument() call, but that can become tedious. So I suggest adding a
metavars argument to the ArgumentParser constructor; default
metavars=None (current behaviour); metavars=type (show type names). And
of course, allow metavars specified in add_argument() calls to override
on a case by case basis.

--
components: Library (Lib)
messages: 128300
nosy: bethard
priority: low
severity: normal
stage: needs patch
status: open
title: add argparse formatting option to display type names for metavar
type: feature request
versions: Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11174
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com