Add terraform prompt

This commit is contained in:
Pavle Portic 2020-11-14 16:44:56 +01:00
parent 1f1390148a
commit 815c19fde8
Signed by: TheEdgeOfRage
GPG Key ID: 6758ACE46AA2A849
1 changed files with 12 additions and 0 deletions

View File

@ -152,6 +152,17 @@ prompt_virtualenv() {
fi
}
# Terraform: current terraform workspace
prompt_tf() {
# dont show 'default' workspace in home dir
[[ "$PWD" == ~ ]] && return
# check if in terraform dir
if [ -d .terraform ]; then
workspace=$(terraform workspace show 2> /dev/null) || return
prompt_segment magenta black "[${workspace}]"
fi
}
# Status:
# - was there an error
# - am I root
@ -179,6 +190,7 @@ build_prompt() {
prompt_virtualenv
prompt_context
prompt_dir
prompt_tf
prompt_git
prompt_end
}