-
Notifications
You must be signed in to change notification settings - Fork 481
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
unused positional argument / value #847
Comments
I'm also seeing unprocessed Values handled as valid but ignored even if void Main()
{
var jsonOptions = new JsonSerializerOptions { WriteIndented = true, Converters = { new JsonStringEnumConverter() } };
var args = new[] { "verb", "verbValue0", "verbValue1", "--option", "optionArg" };
var parser = new Parser(settings =>
{
settings.CaseSensitive = false;
settings.HelpWriter = Console.Out;
settings.IgnoreUnknownArguments = false;
});
var result = parser.ParseArguments<VerbOptions, object>(args);
Console.WriteLine(JsonSerializer.Serialize(new { result.Errors, result.Tag, result.Value }, jsonOptions));
}
[Verb("verb")]
class VerbOptions
{
// [Value(0)]
// public IEnumerable<string> VerbValues { get; set; }
[Option]
public string Option { get; set; }
} outputs:
The tokens
|
I also had this issue. I was taking a look into the code and there is currently no way to determine whether the values have been consumed or not. I added a PR to fix the issue. Hope it will be reviewed soonish. |
I got no parsing error if a positional argument is present
example:
no value/positional arguments allowed at all
option with space
abc.exe -t myPath/with a/unwandted/space
so the option is myPath/with and the rest is completely lost without an error
Am I missing a special configuration here?
The text was updated successfully, but these errors were encountered: