Issue 50 in argparse: convention for reporting program name and version by default

0 views
Skip to first unread message

argp...@googlecode.com

unread,
Dec 15, 2009, 8:22:27 AM12/15/09
to argpar...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 50 by techtonik: convention for reporting program name and
version by default
http://code.google.com/p/argparse/issues/detail?id=50

Neither optparse not argparse 1.0.1 provide user friendly reporting of
program name and version by default.

I propose the following convention to be supported by argument parsing
library by default.
1. When user calls script.py without arguments the following information is
displayed
> script.py
Full Program Name, version XXX

Usage: script.py <...>

Short Description

Options:

...

> script.py --version
Full Program Name, version XXX
{version template if present with license info or script doc block or ...}

What is the expected output? What do you see instead?
There is `prog` argument to ArgumentParser() that allows to specify script
name in `"usage: ..."` line, but no argument to specify full program name.

--version outputs just a number that is not sufficient. In most cases I
would also like to see revision (as user) or display copyright (as
developer) or just module docblock that contains both.

Please provide any additional information below.
It would be nice if argparse could stick to this default output if both
'version' and 'fullname' information is present and allow to customize
templates before usage, usage itself, short description and options.

Take a look at 'hg' (or 'svn') command line interface for an example of
this approach.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

argp...@googlecode.com

unread,
Dec 15, 2009, 12:26:36 PM12/15/09
to argpar...@googlegroups.com
Updates:
Status: Accepted
Labels: -Type-Defect Type-Enhancement

Comment #1 on issue 50 by steven.bethard: convention for reporting program
This is definitely doable, since the output format would only change when
the new
fullname= argument was supplied. I'll try to add this for the next release,
though if
you're feeling ambitious, feel free to produce a patch yourself, and I'll
review it.

argp...@googlecode.com

unread,
Jul 23, 2010, 8:12:46 AM7/23/10
to argpar...@googlegroups.com
Updates:
Status: WontFix

Comment #2 on issue 50 by steven.bethard: convention for reporting program

Hmm. So I looked around, and I can't find an example of this being used in
a command line program *before* the "usage:". Here's svn:

$ svn help
usage: svn <subcommand> [options] [args]
Subversion command-line client, version 1.6.5.

If it's after "usage:" you can just add it to the description text. It's
only that if it needs to be before usage that you can't do it with argparse
yet.

I'm closing this as WontFix, but if you would really like the ability to
add text before "usage:" and not just after, please open a new ticket on
bugs.python.org (argparse's new home), preferably with the output of a
couple different command line programs that do this so I can see exactly
what needs to be supported.

argp...@googlecode.com

unread,
Jul 26, 2010, 10:20:13 AM7/26/10
to argpar...@googlegroups.com

Comment #3 on issue 50 by techtonik: convention for reporting program name

Better take a look at Bazaar and Mercurial. They are potential users of
argparse.

argp...@googlecode.com

unread,
Jul 26, 2010, 5:56:23 PM7/26/10
to argpar...@googlegroups.com

Comment #4 on issue 50 by steven.bethard: convention for reporting program

As I said, please open a new ticket on bugs.python.org. Don't comment on
this issue here - this tracker is no longer in use.

Reply all
Reply to author
Forward
0 new messages