-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
cli.Command: Argument order is changed depending on the flag set #355
Comments
@brenol definitely a bug, thank you for the report! |
This appears to be due to the argument reordering that is done to try to trick the stdlib https://github.com/codegangsta/cli/blob/master/command.go#L104-L116 |
I think this supersedes #103 too -- my opinion is to remove the reordering. |
Removing the ordering seems like a fine answer. I looked at this for a while today, and there's really no way to fix it without, like you said @jszwedko, a whole bunch of complicated flag preprocessing. |
This was introduced by #36, but only worked in the specific case of all arguments being passed before all flags. If the user mixed them, they ended up with odd parsing behavior where the arguments were reordered (causing #103 and #355). Given the tradeoffs I think we should remove support for flag reordering. Fixes #103 Fixes #355
Fixed by #398 (requires use of the |
Hello!
I'm not sure if this is the expected behavior, however the following code:
Runs differently depending on the position of the arguments passed:
Expected behavior for me would be that when running the second command, the following should output:
It seems that the fact that the flag is in the middle is breaking the Args() order.
Thanks
The text was updated successfully, but these errors were encountered: