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

Parser preferences option alias over option argument. #610

Open
tannergooding opened this issue Aug 8, 2019 · 1 comment

Comments

@tannergooding
Copy link
Member

commented Aug 8, 2019

If you have two options:

var argument = new Argument {
                ArgumentType = typeof(string),
                Arity = ArgumentArity.ExactlyOne,
                Name = "prefix"
            };
            argument.SetDefaultValue(string.Empty);

            var option = new Option("--prefixStrip", "The prefix to strip from the generated method bindings.", argument);
            option.AddAlias("-p");

            rootCommand.AddOption(option);

and

var argument = new Argument {
                ArgumentType = typeof(string),
                Arity = ArgumentArity.OneOrMore,
                Name = "arg"
            };
            argument.SetDefaultValue(Array.Empty<string>());

            var option = new Option("--additional", "An argument to pass to Clang when parsing the input files.", argument);
            option.AddAlias("-a");

            rootCommand.AddOption(option);

You cannot pass in -a -pedantic as the parser interprets it as -a and -p -e -d -a -n -t -i -c.

@tannergooding

This comment has been minimized.

Copy link
Member Author

commented Aug 8, 2019

I would expect there to be some mechanism under which I could say that an option requires an argument and that the next token following the option would always be interpreted as its input.

@jonsequitur jonsequitur added the bug label Aug 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.