mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-10-02 16:03:47 +02:00
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
This commit is contained in:
1 parent
6fbad5bf72
commit
0ab87c26c1
2 files changed
+3
-2
No files matched your search
@@ -18,6 +18,7 @@ function chruby_prompt_info \
|
||||
vi_mode_prompt_info \
|
||||
virtualenv_prompt_info \
|
||||
jenv_prompt_info \
|
||||
tf_prompt_info \
|
||||
{
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ function tf_prompt_info() {
|
||||
# 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
|
||||
if [[ -d .terraform && -r .terraform/environment ]]; then
|
||||
workspace=$(cat .terraform/environment) || return
|
||||
echo "[${workspace}]"
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user