feat: add fish shell completions to README #52
Conversation
Add a short entry to README about how to install completions for `fish` shell. It's a hack for now (based on https://github.com/evanlucas/fish-kubectl-completions), but it works
@awinecki As I'm very new to fish, I did some testing on my side to make sure this is working, and I found another way to achieve it which look possibly simpler. I added below function in function kubectl
kubecolor $argv
end Then, I just run |
@dty1er that's actually brilliant, haven't thought of it :). Works on my machine. I've changed the PR to guide fish users using your method. I think it's a good default. I've also included a hint for people that would like to have both |
README.md
Outdated
@@ -129,7 +129,23 @@ compdef kubecolor=kubectl | |||
|
|||
#### fish | |||
|
|||
Fish completion is unsupported because fish completion is officially not supported by kubectl. | |||
For fish, you can achieve completions for `kubecolor` in two steps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change this sentence?
I want to emphasize that this is unofficial hack because it is not official way provided by kubernetes project.
For fish, you can achieve completions for `kubecolor` in two steps: | |
Fish completion is officially unsupported by kubectl, so it is unsupported by kubecolor as well. | |
However, there are 2 ways we can introduce to make completion work. | |
Please keep in mind these ways are a kind of "hack" and not officially supported. | |
1. Use "fish-kubectl-completions" with kubecolor | |
[evanlucas/fish-kubectl-completions](https://github.com/evanlucas/fish-kubectl-completions) is popular for fish users who wants kubectl completions in fish shell. | |
You can "override" kubectl with kubecolor and make it work even with kubecolor. You need to follow below 2 steps: |
README.md
Outdated
1. Install `kubectl` completions (https://github.com/evanlucas/fish-kubectl-completions) | ||
|
||
```shell | ||
fisher install evanlucas/fish-kubectl-completions | ||
``` | ||
|
||
2. Add the following function to your `config.fish` file: | ||
|
||
```shell | ||
function kubectl | ||
kubecolor $argv | ||
end | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add indents(2 spaces) to these 2 steps because they belong to above 1. Use "fish-kubectl-completions" with kubecolor
README.md
Outdated
end | ||
``` | ||
|
||
**NOTE:** This will override `kubectl` command. If you wish to preserve both `kubectl` and `kubecolor` with completions, you need to copy completions for `kubecolor` command (e.g. https://github.com/awinecki/fish-kubecolor-completions). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure some people will prefer fish-kubecolor-completions, so let's add some description:
**NOTE:** This will override `kubectl` command. If you wish to preserve both `kubectl` and `kubecolor` with completions, you need to copy completions for `kubecolor` command (e.g. https://github.com/awinecki/fish-kubecolor-completions). | |
2. Use awinecki/fish-kubecolor-completions | |
The first way will override `kubectl` command. If you wish to preserve both `kubectl` and `kubecolor` with completions, you need to copy evanlucas/fish-kubectl-completionsfor for `kubecolor` command. | |
For this purpose, you can use [awinecki/fish-kubecolor-completions](https://github.com/awinecki/fish-kubecolor-completions). |
@awinecki |
@dty1er no problem ;) I've applied most of your suggestions, added some .md formatting for links etc. 馃檶 |
Cool, thanks a lot for your great contribution. |
Hello; such a great project! I'm just learning k8s, and I like my CLI UI to be clean and readable.
As I've been using fish for a while now, I was sad to discover I can't use
kubecolor
with proper completions with fish. Completions are necessary to me for learning, so I tried to make it work.As I'm no expert when it comes to hacking
fish
, I just took @evanlucas (thx ! 馃檹 ) completions, and replaced allkubectl
withkubecolor
. It's ugly, but it works.@evanlucas, perhaps you could guide me how to do it in a cleaner way. I know little about
go
, and seems you're using it to generate these completions. Worst case, I could just set up a github action that periodically fetches yourkubectl
completions and buildskubecolor
ones from that.