-
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
Passing arg to bool flag breaks other flags #1964
Comments
@svartkanin The whole point of bool flags is to not pass an arg. Why are you passing an arg for the bool flag in the first place ? |
@dearchap I'm aware of that, but if someone accidentally uses the flags this way there will be unintentional behaviour because the parsing is all messed up for the flags coming after as it does not terminate. |
It's not easy. What happens if 'wrong' is actually defined as a sub command ? We would then try to process it as such thinking that's what the user intended |
If there is no subcommand defined with that name and the Args parameter is set to false for the given command this should result in a failure |
Also issue with boolFlag in v3.0.0-alpha9:
|
Its not really an issue. Its the design for command line flags in general. As per this https://pkg.go.dev/flag this is the standard format
without that it becomes ambigious. We cannot intend user's intention here. |
My urfave/cli version is
v2.27.4
Checklist
Dependency Management
Describe the bug
Using a boolean flag with a argument does not terminate the command.
To reproduce
Observed behavior
When a argument is passed to a bool flag then subsequent flags are not read correctly anymore
Expected behavior
If a argument is passed to a bool flag then the command should fail as that is an invalid input
Run
go version
and paste its output hereThe text was updated successfully, but these errors were encountered: