Skip to content
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

Fish completion is broken for option flags if/when leading options contain "special" shell characters. #1571

Open
ichekrygin opened this issue Mar 10, 2024 · 4 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@ichekrygin
Copy link

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
@ichekrygin ichekrygin added the kind/bug Categorizes issue or PR as related to a bug. label Mar 10, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Mar 10, 2024
@eddiezane
Copy link
Member

eddiezane commented Mar 12, 2024

Parenthesis ( ) are not valid characters for labels. Were you able to label a pod that way?

https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set

Edit: TIL we have filter querying builtin https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#list-and-watch-filtering

/triage accepted

@eddiezane eddiezane added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 12, 2024
@mohitsharma-in
Copy link
Contributor

Folks can i pick this up

@Ritikaa96
Copy link
Contributor

Hi @mohitsharma-in if you think you can work to solve this issue you can self assign with /assign .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

5 participants