From bae6eefd69f9ee9ca428ecf643e74e582ba2c2d9 Mon Sep 17 00:00:00 2001 From: Florian Rey Date: Sun, 13 Oct 2024 17:58:02 +0200 Subject: [PATCH] feat(helmfile): introduce helmfile plugin --- plugins/helmfile/README.md | 16 ++++++++++++++++ plugins/helmfile/helmfile.plugin.zsh | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 plugins/helmfile/README.md create mode 100644 plugins/helmfile/helmfile.plugin.zsh diff --git a/plugins/helmfile/README.md b/plugins/helmfile/README.md new file mode 100644 index 000000000..10f1a7e0d --- /dev/null +++ b/plugins/helmfile/README.md @@ -0,0 +1,16 @@ +# Helmfile plugin + +This plugin adds completion and aliases for [Helmfile](https://helmfile.readthedocs.io/), the declarative helm charts deployer. + +To use it, add `helmfile` to the plugins array in your zshrc file: + +```zsh +plugins=(... helmfile) +``` + +## Aliases + +| Alias | Full command | +| ----- | ---------------------- | +| hf | helmfile | +| hfi | helmfile --interactive | diff --git a/plugins/helmfile/helmfile.plugin.zsh b/plugins/helmfile/helmfile.plugin.zsh new file mode 100644 index 000000000..6c96eb68b --- /dev/null +++ b/plugins/helmfile/helmfile.plugin.zsh @@ -0,0 +1,18 @@ +# Completion +if (( ! $+commands[helmfile] )); then + return +fi + +# If the completion file doesn't exist yet, we need to autoload it and +# bind it to `helmfile`. Otherwise, compinit will have already done that. +if [[ ! -f "$ZSH_CACHE_DIR/completions/_helmfile" ]]; then + typeset -g -A _comps + autoload -Uz _helmfile + _comps[helmfile]=_helmfile +fi + +helmfile completion zsh >| "$ZSH_CACHE_DIR/completions/_helmfile" &| + +# Aliases +alias hf='helmfile' +alias hfi='helmfile --interactive'