Skip to content

Instantly share code, notes, and snippets.

@RHeynsZa
Last active April 27, 2023 11:06
Show Gist options
  • Save RHeynsZa/fbefefdd94c89327c56bc7ff6a6be096 to your computer and use it in GitHub Desktop.
Save RHeynsZa/fbefefdd94c89327c56bc7ff6a6be096 to your computer and use it in GitHub Desktop.
ZSH Prompt for running containers
# This function is used to list the amount of running docker containers in p10k
# Make sure to also just add my_docker to your prompt list
function promt_my_docker(){
# Whale icon
# docker ps | wc -l
local containers=$(docker ps | wc -l)
# Need to remove the first line
containers=$((containers-1))
# Only output the whale icon if there are containers running
if [ $containers -gt 0 ]; then
p10k segment -f 3 -i '🐳' -t ${containers}
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment