Unverified Commit 0ab87c26 authored by Vlad Korolev's avatar Vlad Korolev Committed by GitHub
Browse files

fix(terraform): use faster method to get workspace (#9709)

Also add tf_prompt_info to the list of prompt functions so theme writers are aware of it
parent 6fbad5bf
...@@ -18,6 +18,7 @@ function chruby_prompt_info \ ...@@ -18,6 +18,7 @@ function chruby_prompt_info \
vi_mode_prompt_info \ vi_mode_prompt_info \
virtualenv_prompt_info \ virtualenv_prompt_info \
jenv_prompt_info \ jenv_prompt_info \
tf_prompt_info \
{ {
return 1 return 1
} }
......
...@@ -2,8 +2,8 @@ function tf_prompt_info() { ...@@ -2,8 +2,8 @@ function tf_prompt_info() {
# dont show 'default' workspace in home dir # dont show 'default' workspace in home dir
[[ "$PWD" == ~ ]] && return [[ "$PWD" == ~ ]] && return
# check if in terraform dir # check if in terraform dir
if [ -d .terraform ]; then if [[ -d .terraform && -r .terraform/environment ]]; then
workspace=$(terraform workspace show 2> /dev/null) || return workspace=$(cat .terraform/environment) || return
echo "[${workspace}]" echo "[${workspace}]"
fi fi
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment