Skip to content

Instantly share code, notes, and snippets.

@tomcoakes
Last active March 28, 2021 13:38
Show Gist options
  • Save tomcoakes/9160fe578f8cd52e3da8c3988ea55ce6 to your computer and use it in GitHub Desktop.
Save tomcoakes/9160fe578f8cd52e3da8c3988ea55ce6 to your computer and use it in GitHub Desktop.
displaying current pulumi stack in prompt
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