From 66addc8b45c93f7661a5d8bba93b7b4afcbc23de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Lopes?= <85288424+agnlopes@users.noreply.github.com> Date: Tue, 29 Nov 2022 13:35:57 +0100 Subject: [PATCH] feat(skaffold): add completion (#11357) --- plugins/skaffold/README.md | 9 +++++++++ plugins/skaffold/skaffold.plugin.zsh | 14 ++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 plugins/skaffold/README.md create mode 100644 plugins/skaffold/skaffold.plugin.zsh diff --git a/plugins/skaffold/README.md b/plugins/skaffold/README.md new file mode 100644 index 000000000..4ee12c666 --- /dev/null +++ b/plugins/skaffold/README.md @@ -0,0 +1,9 @@ +# Skaffold plugin (Autocompletion) + +This plugin adds completion for [Skaffold](https://skaffold.dev) + +To use it, add `skaffold` to the plugins array in your zshrc file: + +```zsh +plugins=(... skaffold) +``` diff --git a/plugins/skaffold/skaffold.plugin.zsh b/plugins/skaffold/skaffold.plugin.zsh new file mode 100644 index 000000000..8296c450c --- /dev/null +++ b/plugins/skaffold/skaffold.plugin.zsh @@ -0,0 +1,14 @@ +# Autocompletion for skaffold +if (( ! $+commands[skaffold] )); then + return +fi + +# If the completion file doesn't exist yet, we need to autoload it and +# bind it to `skaffold`. Otherwise, compinit will have already done that. +if [[ ! -f "$ZSH_CACHE_DIR/completions/_skaffold" ]]; then + typeset -g -A _comps + autoload -Uz _skaffold + _comps[skaffold]=_skaffold +fi + +skaffold completion zsh >| "$ZSH_CACHE_DIR/completions/_skaffold" &|