[getopt-sig] there isn't really any discussion here

Russ Cox rsc@plan9.bell-labs.com
Wed, 13 Feb 2002 16:21:27 -0500


> > I admit to being somewhat disheartened by the recurring cries for
> > supposed features like ``optional arguments'' (which introduce parsing
> > ambiguities) and ``mandatory options'' (a contradiction in terms).
> 
> 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.

That's not what I mean by ``optional arguments''.  What I mean is some people
want to define a flag -c that might or might not take an argument.
In this case, it introduces an ambiguity.  If -c takes an optional argument,
does "foo -cd" mean "foo -c -d" or "foo -c d".  What if I want to specify
-c without an argument but then have a normal command-line argument
follow?  If you've got long options with their '--option=argument' syntax,
there's no ambiguity to making the '=argument' not optional.

> This same script only processes data relating to a specific currency.  You
> have to give a currency for it to operate on --currency=EUR.  It can't run
> without knowing a currency to operate on.  Thats mandatory.

Then I don't see why it's not a command line argument.  Why not just 
define that the first thing on the command line after the options
is the currency?  By your scheme, I would have to say 
"ssh --host=mycomputer" instead of "ssh mycomputer".
I don't see the point of using option syntax when the option
isn't really optional.

Russ