-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
prevent removal of valid arguments #95
prevent removal of valid arguments #95
Conversation
Add a test case please. |
800a992
to
8c78327
Compare
test added. |
LGTM. @brendandburns can you review as well? Impacts kube in a few places. |
newargs = append(newargs, y) | ||
} else { | ||
removedFirstX = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being always the bikeshedder, I like this better (and think it's faster, more readable, more efficient...) What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think?
I'm not against it, except for it not working:
[deads@deads-dev-01 cobra]$ go test
Error: unknown command "one"
Run 'print help' for usage.
--- FAIL: TestChildSameName (0.00 seconds)
cobra_test.go:345: Wrong command called
cobra_test.go:348: Command didn't parse correctly
I checked in a similar version that passes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deads2k yeah, so I guess my version was actually mutating the original slice, rather than creating a new slice with just the correct data. Thanks for the new (working) version!
8c78327
to
36aee64
Compare
LGTM |
prevent removal of valid arguments
running a command like:
where
admin
andmy-user
are arguments to theopenshift admin policy add-role-to-user
command, removes theadmin
argument (args[4]
).This pull stops removing more than one token from the
args
for command matches.@smarterclayton Related to openshift/origin#1894