Last active
March 28, 2021 13:38
-
-
Save tomcoakes/9160fe578f8cd52e3da8c3988ea55ce6 to your computer and use it in GitHub Desktop.
displaying current pulumi stack in prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setopt PROMPT_SUBST | |
up_find() | |
{ | |
while [[ $PWD != / ]] ; do | |
find "$PWD"/ -maxdepth 1 "$@" | |
cd .. | |
done | |
} | |
get_pulumi_stack() | |
{ | |
if [[ $(up_find -name 'Pulumi.yaml') ]] then | |
CURRENT_STACK=$(pulumi stack --show-name) | |
print "\n%F{blue}\E[3mcurrent stack: $CURRENT_STACK \E[23m " | |
fi | |
} | |
PS1="\$(get_pulumi_stack)$PS1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment