[getopt-sig] there isn't really any discussion here
Greg Ward
gward@python.net
Wed, 13 Feb 2002 16:23:46 -0500
On 13 February 2002, Derek Harland said:
> I'm not sure I understand either of these worries. To me an optional
> argument is usually a simple flag to the program to indicate something. I
> mean you either compile a c program in debug mode, or you don't.
> Alternatively its something you specify if required, otherwise the program
> decides it for you.
Let's get some terminology straight. Howl if you think these
definitions are bogus:
argument
something in sys.argv (or possibly sys.argv[1:], depending on
your PoV)
option
an argument used to supply extra information to guide or
customize the execution of a program. In Unix, options usually
start with "-" or "--"; in DOS/VMS with "/".
option argument
an argument that follows an option and which is closely associated
with that option, and consumed from the argument list when the
option is. Often, option arguments may also be included in the same
argument as the option, eg.
["-f", "foo"]
may be equivalent to
["-ffoo"]
Some options never take an argument. Some options always take an
argument. Lots of people want an "optional option arguments"
feature, meaning that some options will take an argument if they see
it, and won't if they don't. This is somewhat controversial.
positional argument
something leftover in sys.argv after options have been parsed, ie.
options and option arguments removed from the argument list.
(Note that Optik does not change sys.argv, but returns a copy of
it with only positional args left. Other getopt replacements
might work like this, or they might not.)
required option
an option that must be supplied on the command-line; this is
an oxymoron and I personally consider it poor UI design.
(I gather Russ Cox agrees with me.) Any getopt replacement should
make it fairly easy to implement required options, though, because
lots of people want them.
Greg
--
Greg Ward - nerd gward@python.net
http://starship.python.net/~gward/
There's nothing to see here. Move on; go about your business.