Last active
April 27, 2023 11:06
-
-
Save RHeynsZa/fbefefdd94c89327c56bc7ff6a6be096 to your computer and use it in GitHub Desktop.
ZSH Prompt for running containers
This file contains 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
# 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