mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 04:27:54 +00:00
Merge pull request #6958 from smarterclayton/args_remain_in_order
`kubectl get rc,pods` should invoke in that order
This commit is contained in:
commit
4833578a57
@ -600,8 +600,16 @@ func (b *Builder) Do() *Result {
|
||||
return r
|
||||
}
|
||||
|
||||
// SplitResourceArgument splits the argument with commas and returns unique
|
||||
// strings in the original order.
|
||||
func SplitResourceArgument(arg string) []string {
|
||||
out := []string{}
|
||||
set := util.NewStringSet()
|
||||
set.Insert(strings.Split(arg, ",")...)
|
||||
return set.List()
|
||||
for _, s := range strings.Split(arg, ",") {
|
||||
if set.Has(s) {
|
||||
continue
|
||||
}
|
||||
out = append(out, s)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user