diff --git a/plugins/tenv/README.md b/plugins/tenv/README.md new file mode 100644 index 000000000..c055256d1 --- /dev/null +++ b/plugins/tenv/README.md @@ -0,0 +1,9 @@ +# tenv plugin + +This plugin adds completion for [tenv](https://github.com/tofuutils/tenv), OpenTofu, Terraform, Terragrunt and Atmos version manager, written in Go. + +To use it, add `tenv` to the plugins array in your zshrc file: + +```zsh +plugins=(... tenv) +``` diff --git a/plugins/tenv/tenv.plugin.zsh b/plugins/tenv/tenv.plugin.zsh new file mode 100644 index 000000000..a66653315 --- /dev/null +++ b/plugins/tenv/tenv.plugin.zsh @@ -0,0 +1,15 @@ +# Autocompletion for tenv +if (( ! $+commands[tenv] )); then + return +fi + +# If the completion file doesn't exist yet, we need to autoload it and +# bind it to `tenv`. Otherwise, compinit will have already done that. +if [[ ! -f "$ZSH_CACHE_DIR/completions/_tenv" ]]; then + typeset -g -A _comps + autoload -Uz _tenv + _comps[tenv]=_tenv +fi + +tenv completion zsh >| "$ZSH_CACHE_DIR/completions/_tenv" &| +