Replace _tofu completion with official tofu completion command

This commit is contained in:
Marc Cornellà 2024-07-13 18:48:26 +02:00
commit 9634a024a3
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B
2 changed files with 7 additions and 548 deletions

View file

@ -1,9 +1,14 @@
# set up the tofu completion (compatible for zsh)
autoload -Uz bashcompinit && bashcompinit
complete -C tofu tofu
# tofu prompt functions
function tofu_prompt_info() {
# dont show 'default' workspace in home dir
[[ "$PWD" != ~ ]] || return
# to keep compatibility with opentofu, the data dir names .terraform in OpenTofu
[[ -d .terraform && -r .terraform/environment ]] || return
local workspace="$(< .terraform/environment)"
echo "${ZSH_THEME_TOFU_PROMPT_PREFIX-[}${workspace:gs/%/%%}${ZSH_THEME_TOFU_PROMPT_SUFFIX-]}"
}
@ -14,7 +19,6 @@ function tofu_version_prompt_info() {
echo "${ZSH_THEME_TOFU_VERSION_PROMPT_PREFIX-[}${tofu_version:gs/%/%%}${ZSH_THEME_TOFU_VERSION_PROMPT_SUFFIX-]}"
}
alias tt='tofu'
alias tta='tofu apply'
alias ttc='tofu console'
@ -28,4 +32,4 @@ alias tts='tofu state'
alias ttsh='tofu show'
alias ttr='tofu refresh'
alias ttt='tofu test'
alias ttws='tofu workspace'
alias ttws='tofu workspace'