You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given an options class with an option of type string:
classOptions{[Option('c',"command", HelpText ="command")]publicstringCommand{get;set;}}classProgram{staticvoidMain(string[]args){varresult= Parser.Default.ParseArguments<Options>(args);
result
.WithParsed<Options>(o =>{ Console.WriteLine($"{o.Command}");}).WithNotParsed(e =>{ Environment.Exit(1);});}}
I would expect multi word values surrounded by quotes to be treated verbatim as a value for the string option.
Instead, CommandLineParser may end up parsing the verbatim string when it shouldn't:
MeasureCommand.exe -c "-a -e"
MeasureCommand 1.0.0
Copyright (C) 2017 MeasureCommand
ERROR(S):
Option 'a' is unknown.
-c, --command command
--help Display this help screen.
--version Display version information.
MeasureCommand.exe -c "-c -a"
MeasureCommand 1.0.0
Copyright (C) 2017 MeasureCommand
ERROR(S):
Option 'c, command' is defined multiple times.
-c, --command command
--help Display this help screen.
--version Display version information.
MeasureCommand.exe -c " -c -a"
c=[ -c -a]
MeasureCommand.exe -c "foo -c -a"
c=[foo -c -a]
The text was updated successfully, but these errors were encountered:
cdmihai
changed the title
Verbatim values are parsed as options
Verbatim values are parsed as options (when they shouldn't)
Aug 18, 2017
cdmihai
changed the title
Verbatim values are parsed as options (when they shouldn't)
Verbatim values are parsed as options (when they shouldn't be)
Aug 18, 2017
Given an options class with an option of type string:
I would expect multi word values surrounded by quotes to be treated verbatim as a value for the string option.
Instead, CommandLineParser may end up parsing the verbatim string when it shouldn't:
The text was updated successfully, but these errors were encountered: