[getopt-sig] Comparing option libraries

Tony J Ibbs (Tibs) tony@lsl.co.uk
Tue, 26 Feb 2002 14:20:40 -0000


Hmm. Mattias Urlichs and (I think?) A.T. Hofkamp seem to think that
"contradicting" oneself on the command line - for example::

    $ command -verify -noverify

is a Bad Thing to do. In theory, I'm not sure that's wrong. However, in
any situation where an "alias" has been defined for a command. this sort
of thing can happen quite naturally. It's certainly been not uncommon on
Unix, and I'm sure I remember similar things on VMS as well. Thus, for
example, if the alias is::

    cmd = command -verify

then the user is quite likely to innocently try::

    cmd -noverify

and be surprised when it doesn't work.

Whilst such use of an alias might be deemed bad style, it's difficult to
see how it is entirely preventable, given it's a property of the OS or
shell, not the command itself...

Also, if options are to be taken from several places (configuration
file, command line, etc.), what is the advantage to Optick or whatever
in *knowing* this? Surely the aim should be to pass down arguments in
order (e.g., those from the configuration file first, then from the
command line) without the "command line" module needing to know that any
of the arguments are "special" in any way. And if *that* is the case,
then allowing contradictory options on the command line is exactly
cognate to allowing them between the configuration file and command
line.

I guess I'm saying that I believe we should clearly separate the "get
options" part of the problem (which looks in the various places options
might be and retrieves interesting stuff) from the "use options" part
(which is given the information therefrom and does something with it). I
would then see having two modes of input to the latter - the first
(configuration file oriented) says "here is an individual option and its
value", and the second (for ease of command line handling) says "here is
a command line [1]_, please use it".

.. [1] I'm agnostic over whether "command line" means
   "sequence of 'words'" or "string to be broken up at
   appropriate delimitors".

Hoping this makes sense and isn't just a diversion, Tibs

--
Tony J Ibbs (Tibs)      http://www.tibsnjoan.co.uk/
Give a pedant an inch and they'll take 25.4mm
(once they've established you're talking a post-1959 inch, of course)
My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.)