Skip to content

Added basic autocompletion for zsh. (#34) - #175

Open
erkyma wants to merge 4 commits into
kubie-org:masterfrom
erkyma:feat/zsh-autocomplete
Open

Added basic autocompletion for zsh. (#34)#175
erkyma wants to merge 4 commits into
kubie-org:masterfrom
erkyma:feat/zsh-autocomplete

Conversation

@erkyma

@erkyma erkyma commented Oct 18, 2023

Copy link
Copy Markdown

No description provided.

@mhkarimi1383

Copy link
Copy Markdown

@antring

Hi,

I'm getting

Error: Not in a kubie shell

with kubie ns

Comment thread completion/kubie.zsh
@juanmirocks

Copy link
Copy Markdown

@mhkarimi1383 I don't get such error. Make sure you're first on a context though.

@sbstp

sbstp commented Jan 5, 2024

Copy link
Copy Markdown
Collaborator

I don't have a zsh setup to test but if someone with zsh can vouch for this I can merge it.

Thanks juanmirocks

Co-authored-by: Dr. Juan Miguel Cejuela <s+github.rv2ujj4ir3@juanmi.rocks>
@mhkarimi1383

Copy link
Copy Markdown

@mhkarimi1383 I don't get such error. Make sure you're first on a context though.

I have an active kubernetes context

@erkyma

erkyma commented Jan 7, 2024

Copy link
Copy Markdown
Author

Thanks for providing a fix @juanmirocks! I had a local version with compdef in the script, but it was missing in the pushed version.

@mhkarimi1383 I don't get such error. Make sure you're first on a context though.

I have an active kubernetes context

Are you in a active kubernetes context within kubie? As in, have you typed kubie ctx, picked a cluster and then tried the autocomplete?
I am unable to produce the error on my end. Could you provide more information?

@mhkarimi1383

Copy link
Copy Markdown

@antring That was my fault :)

Comment thread README.md
```bash
cp .completion/kubie.zsh ~/.zsh/completions
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you can add extra notes for oh-my-zsh

cp .completion/kubie.zsh ${ZSH}/custom/completions/_kubie.zsh

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done some steps but it's not working for me.

kubie ns autocomplete is not working for me

@mhkarimi1383 mhkarimi1383 Jan 8, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autocomplete for kubie itself is also not working

Comment thread README.md
Comment on lines +70 to +74
Autocomplete with Zsh can either be installed by sourcing the file eg.:

```bash
source ./completion/kubie.zsh
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK this will work for the current session ONLY. So it's not the solution or otherwise it should be properly noted.

@eisraeli eisraeli Nov 13, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be added to the zsh profile (e.g. ~/.zshrc).
Then it will be valid for all sessions.

Comment thread README.md Outdated
Comment thread README.md Outdated
@juanmirocks

Copy link
Copy Markdown

@mhkarimi1383 the autocompletions are working for me just fine (also for kubie ns and for kubie itself). I've added some suggestions above to clarify how to make it work. More specific steps can be given if needed.

@janpuc

janpuc commented Feb 16, 2024

Copy link
Copy Markdown

Can confirm that it works, and I guess this is not the scope of this specific task but would be nice to have this built-in with command like kubie completions [bash|fish|zsh].

@miguelchicoespin

Copy link
Copy Markdown

ey, anything stopping this branch to be merged?

Erik and others added 2 commits June 10, 2024 22:33
Co-authored-by: Dr. Juan Miguel Cejuela <s+github.rv2ujj4ir3@juanmi.rocks>
Co-authored-by: Dr. Juan Miguel Cejuela <s+github.rv2ujj4ir3@juanmi.rocks>
@erkyma

erkyma commented Jun 10, 2024

Copy link
Copy Markdown
Author

As far as I know it should be fine to merge. I have been using this at work for months.

@peter-dolkens

Copy link
Copy Markdown

Bump - also looking for this

@eisraeli eisraeli left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this PR with zsh.
I can confirm BASIC usage works, but as this PR was submitted back in October 2023 it's missing the following commands:
export, delete, update

Also, it doesn't provide "deeper" auto-completions, e.g:
kubie info <command>

@antring First of all, thank you for this PR ! :)
Are you into updating this PR? If not, I can make the changes....

@eisraeli

Copy link
Copy Markdown

@antring

Hi,

I'm getting

Error: Not in a kubie shell

with kubie ns

You need to choose a kubie context (via kubie ctx) before trying to auto-complete a namespace.
It makes sense.

@soostdijck

Copy link
Copy Markdown

Came here looking for this, it works fine for me. Time to merge?

@eisraeli

eisraeli commented Mar 26, 2025

Copy link
Copy Markdown

@sbstp As @janpuc suggested, can we have a built-in with command like kubie completion [bash|fish|zsh] ?

@Griznah

Griznah commented Jun 12, 2025

Copy link
Copy Markdown

Awesome! Would be nice if this gets merged soon =)

@vomba

vomba commented Oct 31, 2025

Copy link
Copy Markdown

Just wondering any reason this is still not merged?

@starlightromero

Copy link
Copy Markdown

Bumping. Looking for any updates

@daxmc99

daxmc99 commented Mar 10, 2026

Copy link
Copy Markdown

Also found this, this is blocking me moving from kubens/kubectx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.