Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default value? #100

Open
ekkis opened this issue Sep 16, 2013 · 3 comments
Open

Default value? #100

ekkis opened this issue Sep 16, 2013 · 3 comments

Comments

@ekkis
Copy link

ekkis commented Sep 16, 2013

I've defined an option like this:

[Option('s', HelpText = "Save name", DefaultValue="Main")]
public string SaveName { get; set; }

but when I run my programme as:

c:> test ./file-to-munch.txt -s

I get a failure of ParseArgumentsStrict. what have I done wrong?

@nemec
Copy link
Collaborator

nemec commented Sep 16, 2013

I forget CommandLine's behavior, but what happens if you put the -s before the positional argument? (also, you have defined another option to consume ./file-to-munch.txt, right?)

@ekkis
Copy link
Author

ekkis commented Sep 16, 2013

but I would imagine that

c:> test -s ./file-to-munch.txt

would cause the -s parameter to gobble the filename as an argument, which is not what's intended... which brings up the question, in unix one can use -- to end the options field, so that would allow me to write:

c:> test -s -- ./file-to-munch.txt

and that would mean: 1) specify a -s with the default value, and 2) pass an unbound parameter with value ./file-to-munch.txt

is there support for that syntax here?

@nemec
Copy link
Collaborator

nemec commented Sep 16, 2013

It does. Or at least it should. I haven't tried it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants