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

Please add fish tab completion #576

Closed
wwentland opened this issue Jan 19, 2019 · 29 comments
Closed

Please add fish tab completion #576

wwentland opened this issue Jan 19, 2019 · 29 comments
Labels
area/kubectl kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/cli Categorizes an issue or PR as relevant to SIG CLI.

Comments

@wwentland
Copy link

Fish Completion - Feature Request

Please implement tab completion for the fish shell by building on work done in spf13/cobra#754 or consider shipping automatically generated manpages beforehand.

Unfortunately an earlier feature request (#131) was closed even though the issue had not been addressed. Previous attempts to add completion failed due to the inability to generate them programmatically, but with the changes to cobra referenced above fixing this should be relatively straightforward.

Fish users will appreciate your efforts. Thanks!

Kubernetes version

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.2", GitCommit:"cff46ab41ff0bb44d8584413b598ad8360ec1def", GitTreeState:"clean", BuildDate:"2019-01-10T23:35:51Z", GoVersion:"go1.11.4", Compiler:"gc", Platform:"linux/amd64"}

Related Issues

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 19, 2019
@wwentland
Copy link
Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 2, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 31, 2019
@wwentland
Copy link
Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 2, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 31, 2019
@wwentland
Copy link
Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 31, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 29, 2020
@wwentland
Copy link
Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 30, 2020
@marckhouzam
Copy link
Member

Cobra 1.0 provides support for Fish completion: https://github.com/spf13/cobra/blob/v1.0.0/fish_completions.md

@brianpursley
Copy link
Member

That probably won't help too much since Kubernetes uses Cobra 0.0.5 and it might be a hard sell to to upgrade unless there are already plans to do so.

It might serve as an example, but even if you look at kubectl's zsh completion works, if I recall it does not use Cobra's zsh completion, but instead translates bash completion using a series of seds to make it work for zsh.

Maybe using zsh as an example, something similar could be done for fish.

I don't know much about fish, but if someone wants to work on it, the code would go here:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/kubectl/pkg/cmd/completion/completion.go

var (
	completionShells = map[string]func(out io.Writer, boilerPlate string, cmd *cobra.Command) error{
		"bash": runCompletionBash,
		"zsh":  runCompletionZsh,
                // TODO: add fish here
	}
)

@brianpursley
Copy link
Member

/sig cli
/area kubectl
/kind feature

@k8s-ci-robot k8s-ci-robot added sig/cli Categorizes an issue or PR as relevant to SIG CLI. area/kubectl kind/feature Categorizes issue or PR as related to a new feature. labels Apr 13, 2020
@marckhouzam
Copy link
Member

marckhouzam commented Apr 13, 2020

That probably won't help too much since Kubernetes uses Cobra 0.0.5 and it might be a hard sell to to upgrade unless there are already plans to do so.

Helm just moved from Cobra 0.0.5 to 1.0: helm/helm#7904

From my evaluation the changes are minor and backwards-compatible. But I can understand that upgrading may not happen overnight for kubectl.

It might serve as an example, but even if you look at kubectl's zsh completion works, if I recall it does not use Cobra's zsh completion, but instead translates bash completion using a series of seds to make it work for zsh.

Maybe using zsh as an example, something similar could be done for fish.

Zsh pretty much has the same scripting syntax as bash and has bash-completion compatibility support. Fish has nothing of the sort however with a scripting syntax incompatible with bash.

I think moving to Cobra 1.0 will be far less effort than developing anything specific to kubectl for fish completion.

@brianpursley
Copy link
Member

Looks like kubernetes has cobra 1.0.0 now...
kubernetes/kubernetes@205ded2

@brianpursley
Copy link
Member

I'll see if I can upgrade the completion to use all shells supported by cobra 1.0.0...
Fish, PowerShell, and change Zsh to use cobra's implementation

/assign

@marckhouzam
Copy link
Member

I'll see if I can upgrade the completion to use all shells supported by cobra 1.0.0...
Fish, PowerShell,

Nice!
Be aware that Fish completion will not provide kubectl's custom completions. For that to work, kubectl must move from custom completions written in bash code to custom completions written in Go, as introduced in Cobra 1.0 (the new command.ValidArgsFunction field and the one for flags).

Also PowerShell completions do not support custom completions of any form at this time.

and change Zsh to use cobra's implementation

Don't do that yet. Cobra 1.0's support for zsh has less functionality than kubectl's current one. For example, again, no support for custom completion.

spf13/cobra#1070 brings Zsh completion to the level of bash completions, but will only work with custom completions written in Go. So, until custom completions are modified in kubectl (and the mentioned PR is released), it is better to stay with the current solution for zsh completion.

@brianpursley
Copy link
Member

@marckhouzam thanks for the heads up. After my last comment I also saw that cobra has a new way to implement dynamic completion, and the old way only works for bash (and zsh in our case since it just modifies bash completion).

As part of this, I'll see what it would take to move to the new dynamic completion approach. At first glance it seems like it would be an improvement.

Regarding zsh completion, I totally agree now that I looked more into it.

I know how long it took to get zsh completion where it is today, so I definitely don't want to do anything to make it worse, so yeah, I'll probably keep zsh they way is and just focus on getting fish working for now.

@marckhouzam
Copy link
Member

@brianpursley if you manage to get rid of the old dynamic completion code to use the new way, not only will it remove bash code that's difficult to maintain and test, but you'll improve fish completion automatically, and eventually you'll be able to move to native zsh completion which provide completion descriptions, which are currently not supported in kubectl's zsh solution.

So I fully agree that such an effort would provide value. Thanks!

@eddiezane
Copy link
Member

/priority backlog

@k8s-ci-robot k8s-ci-robot added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Jul 22, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 20, 2020
@brianpursley
Copy link
Member

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 20, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 18, 2021
@AlekSi
Copy link

AlekSi commented Jan 18, 2021

/remove-lifecycle stale

@marckhouzam
Copy link
Member

For full fish shell completion support, we need to move to go custom completions, which is done in kubernetes/kubernetes#96087. Hopefully that PR can get merged eventually.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 15, 2021
@szpak
Copy link

szpak commented May 15, 2021

Merging kubernetes/kubernetes#96087 is slowly going forward...

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 15, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 13, 2021
@szpak
Copy link

szpak commented Aug 15, 2021

kubernetes/kubernetes#96087 is merged and kubernetes/kubernetes#92989 is on its way. There is a chance to have it implemented "soon"...

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 15, 2021
@eddiezane
Copy link
Member

Closed via kubernetes/kubernetes#92989

/close

@k8s-ci-robot
Copy link
Contributor

@eddiezane: Closing this issue.

In response to this:

Closed via kubernetes/kubernetes#92989

/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubectl kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/cli Categorizes an issue or PR as relevant to SIG CLI.
Projects
None yet
Development

No branches or pull requests

9 participants