From 5b14c70c9214a09fb42a2e19263b0a2040f539de Mon Sep 17 00:00:00 2001 From: Shubham Rajvanshi Date: Mon, 23 Sep 2024 17:20:35 -0500 Subject: [PATCH] added k9s completions --- plugins/k9s/README.md | 9 +++++++++ plugins/k9s/k9s.plugin.zsh | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 plugins/k9s/README.md create mode 100644 plugins/k9s/k9s.plugin.zsh diff --git a/plugins/k9s/README.md b/plugins/k9s/README.md new file mode 100644 index 000000000..275048cdb --- /dev/null +++ b/plugins/k9s/README.md @@ -0,0 +1,9 @@ +# k9s plugin + +This plugin adds completion support for the [k9s](https://k9scli.io). + +To use it, add `k9s` to the plugins array in your zshrc file: + +```zsh +plugins=(... k9s) +``` diff --git a/plugins/k9s/k9s.plugin.zsh b/plugins/k9s/k9s.plugin.zsh new file mode 100644 index 000000000..2c1961b30 --- /dev/null +++ b/plugins/k9s/k9s.plugin.zsh @@ -0,0 +1,11 @@ +if (( $+commands[k9s] )); then + # If the completion file does not exist, generate it and then source it + # Otherwise, source it and regenerate in the background + if [[ ! -f "$ZSH_CACHE_DIR/completions/_k9s" ]]; then + k9s completion zsh | tee "$ZSH_CACHE_DIR/completions/_k9s" >/dev/null + source "$ZSH_CACHE_DIR/completions/_k9s" + else + source "$ZSH_CACHE_DIR/completions/_k9s" + k9s completion zsh | tee "$ZSH_CACHE_DIR/completions/_k9s" >/dev/null &| + fi +fi