[Python-Dev] Python long command line options
Nick Coghlan
ncoghlan at gmail.com
Thu May 4 15:36:50 CEST 2006
Heiko Wundram wrote:
> Anyway, back on topic, I personally agree with the people who posted to
> comp.lang.python that --version (and possibly --help, possibly other long
> parameters too) would be useful additions to Pythons command-line parameters,
> as it's increasingly getting more common amongst GNU and BSD utilities to
> support these command-line options to get information about the utility at
> hand (very popular amongst system administrators) and to use long commandline
> options to be able to easily see what an option does when encountered in a
> shell script of some sort.
+0 from me, as long as the 'best guess' bit removed. Otherwise '-v' would be
"verbose", while "--v" was "version". And if we added '--verbose' later,
scripts relying on '--v' would start getting an error. Much better to force
people to spell the option right in the first place.
And any such patch would require additional tests in test_cmd_line.py if the
new option is equivalent to an option that's already tested by that file.
Being able to give less cryptic names to the various options would be good for
shell scripts and sys calls.
e.g.:
-c ==> --command
-d ==> --debugparser
-E ==> --noenv
-h ==> --help
-i ==> --interactive
-m ==> --runmodule
-O ==> <no long equivalent>
-OO ==> <no long equivalent>
-Q ==> --div old, --div warn, --div warnall, --div new
-S ==> --nosite
-t ==> --warntabs
-tt ==> --errtabs
-u ==> --unbuffered
-v ==> --verbose
-V ==> --version
-W ==> --warn
-x ==> --skipfirstline
As far as I know, the only place these are documented is in "python -h" and
the Linux man pages.
And good luck to you if you encounter a sys call containing "python -U". Even
though not recognising the meaning of the option is likely to be the least of
your worries in that case, at least you'd have some idea *why* some Python
scripts start collapsing in a screaming heap when you try it ;)
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-Dev
mailing list