nobu.nokada / softhome.net writes:

> Hi,
>
> At Tue, 21 Jan 2003 04:27:47 +0900,
> Matt Armstrong wrote:
>> ruby-cvs -roptparse -e 'ARGV.options{|opt|opt.on("--dir=[DIR]"){|d|@dir=d};opt.parse!};p self' -- --dir here
>> #<Object:0x401b89fc @dir=nil>
>> 
>> Optional arguments are not "greedy" but I would expect them to be.
>
> It sounds non-optional.  If it were "greedy", how do you omit
> the option value?

I see your point, but I have one idea.

The next element in ARGV is taken to be an optional argument if it
does not begin with a - character.

2 options:

    --dir --foo

1 option:

    --dir /tmp

1 option (only if optional value begins with - is the = required):

    --dir=-somewhere

I think most humans would find this understandable.  :-)