Closed
Description
What happened:
Type kubectl
command and invoke [TAB] completion after the "-" prefix .
kubectl get pod -l 'app in(test)' -[TAB]
What you expected to happen:
Expected to see completion options like the following:
kubectl get pod -l 'app in(foo)' -
-A --all-namespaces (If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.)
-f --filename (Filename, directory, or URL to files identifying the resource to get from a server.)
-h --help (help for get)
-k --kustomize
...
Instead, kubectl fish completion reports an error:
kubectl get pod -l 'app in(foo)' -fish: Unknown command: foo
in command substitution
called on line 1 of file /opt/homebrew/share/fish/vendor_completions.d/kubectl.fish
in command substitution
called on line 42 of file /opt/homebrew/share/fish/vendor_completions.d/kubectl.fish
in function '__kubectl_perform_completion'
called on line 1 of file /opt/homebrew/share/fish/vendor_completions.d/kubectl.fish
in command substitution
called on line 84 of file /opt/homebrew/share/fish/vendor_completions.d/kubectl.fish
in function '__kubectl_perform_completion_once'
called on line 106 of file /opt/homebrew/share/fish/vendor_completions.d/kubectl.fish
in function '__kubectl_requires_order_preservation'
in command substitution
/opt/homebrew/share/fish/vendor_completions.d/kubectl.fish (line 1): Unknown command
KUBECTL_ACTIVE_HELP=0 kubectl __complete get pod -l app in(foo) -
^~~~^
...
How to reproduce it (as minimally and precisely as possible):
kubectl get pod -l 'app in (foo)' -[TAB]
Anything else we need to know?:
This issue is due to the BUG in https://github.com/spf13/cobra with pending fix in PR: spf13/cobra#2095
Environment:
- Kubernetes client and server versions (use
kubectl version
):Client Version: v1.29.2
- Cloud provider or hardware configuration: N/A
- OS (e.g:
cat /etc/os-release
): Any/All