-
-
Notifications
You must be signed in to change notification settings - Fork 452
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
Support options before arguments #193
Comments
FYI I came here after looking through the issues. I believe the related error message is
This is not an issue with Options that have a value (eg. |
Even as a developer, I was quite confused by the "Can't assign value" error message. Ideally, options would be allowed before arguments, but at the very least, could the error message be improved? |
Cake has an open issue closely related to this, cake-build/cake#3280, basically looking to move all the cake command options before the build script argument, allowing any options following the command argument to automatically become remaining arguments. |
This issue is occuring due to the way that CommandTreeParser is handling Options, namely peeking ahead to the next argument to determine what to do. The following image is when I've specified the following on the command line It knows to correctly ignore the following When I specify the following on the command line CommandTreeParser.ParseOptionValue proceeds to attempt to set the --version Option to this value, unsuccessfully: For @woutervanranst 's example above to work correctly,
I guess the CommandTreeParser needs to
|
I m assuming we don t need to reinvent the wheel here, I expect there are nasty edge cases we re missing - linux CLI parsers would have solved this already |
I'm happy to have a go at this issue @patriksvensson - please assign it to me. |
@FrankRay78 Done! |
This issue can be closed/marked as complete @patriksvensson, now that PR #1048 has been successfully merged. |
Especially for Unix/Linux platforms, the convention is usually to provide options before arguments:
Using boolean options before arguments currently gets incorrectly interpreted as assigning a value to the option flag. Would be good to support this ordering (preferably alongside existing behaviour).
The text was updated successfully, but these errors were encountered: