getopt & single-letter options with parameters

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Aug 8 14:44:14 PDT 2010


On 08/08/2010 04:02 PM, Nick Sabalausky wrote:
> "Andrei Alexandrescu"<SeeWebsiteForEmail at erdani.org>  wrote in message
> news:i3n12a$2vfq$1 at digitalmars.com...
>> On 08/08/2010 12:17 PM, Nick Sabalausky wrote:
>>> "Andrei Alexandrescu"<SeeWebsiteForEmail at erdani.org>   wrote in message
>>> news:i3kpsi$rod$1 at digitalmars.com...
>>>>
>>>> ./prog -ofilename
>>>
>>> That being allowed at all kind of bugs me. I realize this probably isn't
>>> a
>>> particularly common problem in practice, but suppose you have:
>>>
>>> -o<filename>
>>> -of
>>>
>>> And the user uses "-o" with a file named "f":
>>>
>>> theapp -of  // Do what now?
>>>
>>> Or,
>>>
>>> -o<filename>
>>> -of<filename>
>>>
>>> theapp -ofabc  // "-o fabc" or "-of abc"?
>>>
>>> The whole possibility kinda makes me nervous.
>>
>> Short options with parameters don't accept bundling, so the problem never
>> shows itself.
>>
>
> This then:
>
> --xy<filename>
> --xyz<filename>
>
> theapp --xyzabc  // "--xy zabc" or "-xyz abc"?

The long form with parameters accepts "--name=value" and "--name value" 
but not "--namevalue".

Andrei


More information about the Digitalmars-d mailing list