feat(tenv): Add tenv plugin

Add plugin with completions for tenv:
OpenTofu, Terraform, Terragrunt and Atmos version manager, written in Go.
This commit is contained in:
Carlos Colaço 2024-05-26 13:52:25 +02:00
commit fd403258f9
No known key found for this signature in database
GPG key ID: 31A25E931748A8F9
2 changed files with 24 additions and 0 deletions

9
plugins/tenv/README.md Normal file
View file

@ -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)
```

View file

@ -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" &|