[issue9234] argparse: aliases for positional arguments (subparsers)

Steven Bethard report at bugs.python.org
Fri Dec 17 16:47:18 CET 2010


Steven Bethard <steven.bethard at gmail.com> added the comment:

The patch looks basically okay to me, though this line makes me nervous:

  dest += ' (%s)' % ', '.join(aliases)

Since this is just for help formatting, can't you just modify metavar instead? The dest is the attribute on the namespace where the result should be stored. The metavar is the value that should be displayed in help messages.

As to where the aliases should be printed, I don't have a strong preference. The svn aliases show up when you do a generic "svn help" (but not if you do a "svn help blame") and looks like:

Available subcommands:
   add
   blame (praise, annotate, ann)
   ...

The hg aliases show up when you do a "hg help commit" (but not if you do a "hg help") and looks like:

hg commit [OPTION]... [FILE]...

aliases: ci

I guess the patch makes it pretty easy to emulate the svn version.

----------

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


More information about the Python-bugs-list mailing list