Merge pull request #131586 from ardaguclu/kuberc-completion

Continue alias creation when __completion is used to enable completion

Kubernetes-commit: 893486dfd16ff8c628c6f33bb2bea869ad86115f
This commit is contained in:
Kubernetes Publisher 2025-05-04 22:21:56 -07:00
commit bb3c0d9f3a
2 changed files with 3 additions and 1 deletions

2
go.mod
View file

@ -92,3 +92,5 @@ require (
sigs.k8s.io/kustomize/api v0.19.0 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
)
replace k8s.io/code-generator => k8s.io/code-generator v0.0.0-20250503071920-ec35be305d73

View file

@ -194,7 +194,7 @@ func (p *Preferences) applyAliases(rootCmd *cobra.Command, kuberc *config.Prefer
var commandName string // first "non-flag" arguments
var commandIndex int
for index, arg := range args[1:] {
if !strings.HasPrefix(arg, "-") {
if !strings.HasPrefix(arg, "-") && !strings.HasPrefix(arg, cobra.ShellCompRequestCmd) {
commandName = arg
commandIndex = index + 1
break