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

Make kubectl-prompt suitable for use with zsh #9

Open
grzesuav opened this issue Apr 10, 2019 · 8 comments
Open

Make kubectl-prompt suitable for use with zsh #9

grzesuav opened this issue Apr 10, 2019 · 8 comments

Comments

@grzesuav
Copy link

Is your feature request related to a problem? Please describe.
Currently it is impossible to use kubectl-prompt with zsh because :

  • function definition does not work in zsh
  • changes are kept in .bash_profile

Describe the solution you'd like

  • change function kubectl () definition to be both bash and zsh compatibile
  • store configuration (cluster, namespaces, function definition) outside .bash_profile
  • source configuration (from above) in .bash_profile or .zshrc (depending on shell)

Additional context
Currently when I extracted configuration to separate file and try to source it in zsh I get

kubectl: command not found: kubectl () {\n\tkube=$(which kubectl) \n\t$kube prompt "${@}" && command $kube "${@}"\n}

probably because different handling of references in zsh (problematic part : kube=$(which kubectl) inside a function called kubectl)

@grzesuav
Copy link
Author

I created PR with POC for helper function

@jordanwilson230
Copy link
Owner

Thanks @grzesuav, those are some good points. Support for zsh is a reasonable request, and I appreciate the starter PR as well. I will take a look at this when I have time -- hopefully by tomorrow we can have something.

@grzesuav
Copy link
Author

grzesuav commented May 7, 2019

hi @jordanwilson230 , if sth like this is ok with you I can dig it further :

  • detection of current shell
  • usage of external file (which can be sourced in basrc or zshrc)

Any thoughts from your side ?

@jordanwilson230
Copy link
Owner

@grzesuav That would be terrific and appreciated. I apologize its taken so long, I've been bogged down in work. I'd love to see what you're able to come up with. Thanks!

@ross-bryan
Copy link

+1 to all of this.

@missedone
Copy link

looking for support zsh as well, this is a so cool plugin may save my life in future, never mess up prod env.

@jordanwilson230
Copy link
Owner

Yeah, if anyone wants to contribute to make this happen, that'd be sweet.

@mabushey
Copy link

mabushey commented Mar 2, 2021

Just copy the plugins to /usr/local/bin and it works. No reason to do all this song and dance pollute the PATH crap.

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

No branches or pull requests

5 participants