Yet another optparse

Kirk McDonald kirklin.mcdonald at gmail.com
Wed Jan 10 01:07:53 PST 2007


CyaNox wrote:
> Does your implementation account for the following:
> 
> app --file="foo bar"
> app --file "some --file with spaces and quoted"
> 

Quoting is taken care of by the shell before the argument even gets to 
your program. So this:

app --file="foo bar"

actually becomes this:

[app,--file=foo bar]

And this:

app --file "some --file with spaces and quoted"

becomes:

[app,--file,some --file with spaces and quoted]

My optparse correctly handles both cases.

If you want to test for what the shell does for you, just use this 
simple program:

import std.stdio;

void main(char[][] args) {
     writefln(args);
}

-- 
Kirk McDonald
Pyd: Wrapping Python with D
http://pyd.dsource.org



More information about the Digitalmars-d mailing list