k0s icon indicating copy to clipboard operation
k0s copied to clipboard

Improve documentation for Zsh autocompletion

Open trawler opened this issue 3 years ago • 3 comments

What happened? The existing documentation on how to enable zsh auto-completion is incorrect/missing information.

Expected behavior In this page: https://docs.k0sproject.io/v0.11.0/install/#zsh

The following should be removed:

# To load completions for each session, execute once:
$ k0s completion zsh > "${fpath[1]}/_k0s"

and replaced by

$ echo "source <(k0s completion zsh)" >> ~/.zshrc

trawler avatar Mar 17 '21 11:03 trawler

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] avatar Jan 19 '22 23:01 github-actions[bot]

That would run k0s on every shell invocation, not a best practice.

The usual way is something like:

k0s completion zsh > /usr/local/share/zsh/site-functions/_k0s

kke avatar Jan 20 '22 07:01 kke

The current example of doing:

k0s completion zsh > "${fpath[1]}/_k0s"

may end up writing the file somewhere weird if you're using some zsh plugin framework, for example on my system it would go to /Users/kimmo/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/functions.

kke avatar Jan 20 '22 07:01 kke