This commit is contained in:
= 2024-07-19 19:02:01 -06:00
parent 717e955b1b
commit 91675dec8e
2 changed files with 27 additions and 1 deletions

View File

@ -13,6 +13,7 @@ $cmake\
$nodejs\
$perl\
$python \
${custom.venv}\
$ruby\
$rust\
$terraform\
@ -86,9 +87,14 @@ command = "~/.config/starship/kubernetes.sh"
when = 'test -n "$(/Users/errol/.config/starship/kubernetes.sh)"'
format = "[ *$output* ](blue bold)"
[custom.venv]
command = "~/.config/starship/venv.sh"
when = 'test -n "$(/Users/errol/.config/starship/venv.sh)"'
format = "[ *$output* ](blue bold)"
[python]
format = '[${symbol}${pyenv_prefix}(\($virtualenv\))]($style)'
format = '[${symbol}]($style)'
symbol = '🐍'
# [status]
# disabled = false

View File

@ -0,0 +1,20 @@
#!/bin/bash
check_venv() {
pip=$(which pip3)
if [ -z "$pip" ]; then
echo "pip3 not found"
return 1
fi
pipenv=$("$pip" -V 2>&1)
cwd=$(pwd)
if [[ "$pipenv" == *"$cwd"* ]]; then
result=$(echo "$pipenv" | sed -E 's|.*/([^/]+)/venv/lib/[^/]+/site-packages/pip.*|\1|')
echo $result
else
echo ""
fi
}
check_venv