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
Gracefully handle unspecified args with ArgParser #14786
Comments
Well, I found this in the API docs: By default, the parse() method stops as soon as it reaches -- by itself or anything that the parser doesn't recognize as an option, flag, or option value. If arguments still remain, they go into ArgResults.rest. Which looks like it can help me today. |
After playing around the -- doesn't help me because the tools generate the command-line, and they don't put their args after --. So I think I need a "ignore unspecified args" option for ArgParser. |
Will you accept a patch for such a feature? cc @munificent. |
Args has an option now to ignore unspecified arguments, but not unrecognized options. The former lets you have options that appear after non-option arguments. For example: $ myapp some/file.txt --option Args can skip over some/file.txt and parse --option. But it doesn't do that for things that look like options (i.e. a leading "-"). I'd be fine with a patch for the latter too, provided it was an opt-in feature. I'm thinking add a "ignoreUnknownOptions" argument to parse(). |
Thanks Bob. ignoreUnknownOptions as an opt-IN would work. Good to know you'd accept a patch. :) |
Removed Library-Args label. |
Now at dart-lang/args#9 Added MovedToGithub label. |
This issue has been moved to dart-lang/args#23. |
It would be nice to have an option in ArgParser to ignore unspecified args.
Use Case:
Build system specifies its own options.
Build system uses another library that specifies its options.
I want to pass args to both the main build system and the included library:
build.dart --my-option --deploy
The text was updated successfully, but these errors were encountered: