Skip to content

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

Open
erkyma wants to merge 4 commits intosbstp:masterfrom
erkyma:feat/zsh-autocomplete
Open

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

Conversation

@erkyma
Copy link

@erkyma erkyma commented Oct 18, 2023

No description provided.

@mhkarimi1383
Copy link

@antring

Hi,

I'm getting

Error: Not in a kubie shell

with kubie ns

@juanmirocks
Copy link

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

@sbstp
Copy link
Owner

sbstp commented Jan 5, 2024

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

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

I have an active kubernetes context

@erkyma
Copy link
Author

erkyma commented Jan 7, 2024

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

@antring That was my fault :)

```bash
cp .completion/kubie.zsh ~/.zsh/completions
```

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

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

Copy link

@mhkarimi1383 mhkarimi1383 Jan 8, 2024

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 on lines +70 to +74
Autocomplete with Zsh can either be installed by sourcing the file eg.:

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

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.

Copy link

@eisraeli eisraeli Nov 13, 2024

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.

@juanmirocks
Copy link

@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
Copy link

janpuc commented Feb 16, 2024

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

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
Copy link
Author

erkyma commented Jun 10, 2024

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

@peter-dolkens
Copy link

Bump - also looking for this

Copy link

@eisraeli eisraeli left a comment

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

@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

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

@eisraeli
Copy link

eisraeli commented Mar 26, 2025

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

@Griznah
Copy link

Griznah commented Jun 12, 2025

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

@vomba
Copy link

vomba commented Oct 31, 2025

Just wondering any reason this is still not merged?

@starlightromero
Copy link

Bumping. Looking for any updates

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.