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
{{ message }}
Repository navigation
cli.Command: Argument order is changed depending on the flag set #355
This appears to be due to the argument reordering that is done to try to trick the stdlib flag parser to handling commands that have arguments specified before flags (the stdlib flag library stops flag parsing as soon as it encounters the first argument). At first blush, I think supporting this behavior would require much more complicated preprocessing of flags, but I'm open to reviewing a PR addressing this. I'm almost more inclined to remove the re-ordering feature as it appears to only work in very specific circumstances (if you specify all of your arguments before you specify flags).
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.
Activity
jszwedko commentedon Apr 24, 2016
@brenol definitely a bug, thank you for the report!
jszwedko commentedon Apr 24, 2016
This appears to be due to the argument reordering that is done to try to trick the stdlib
flagparser to handling commands that have arguments specified before flags (the stdlibflaglibrary stops flag parsing as soon as it encounters the first argument). At first blush, I think supporting this behavior would require much more complicated preprocessing of flags, but I'm open to reviewing a PR addressing this. I'm almost more inclined to remove the re-ordering feature as it appears to only work in very specific circumstances (if you specify all of your arguments before you specify flags).https://github.com/codegangsta/cli/blob/master/command.go#L104-L116
jszwedko commentedon May 3, 2016
I think this supersedes #103 too -- my opinion is to remove the reordering.
danslimmon commentedon May 7, 2016
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.
Remove reordering of flags and arguments
jszwedko commentedon May 10, 2016
Fixed by #398 (requires use of the
v2branch however as the change was not backwards compatible). Let me know what you think!