starship
This commit is contained in:
parent
717e955b1b
commit
91675dec8e
@ -13,6 +13,7 @@ $cmake\
|
|||||||
$nodejs\
|
$nodejs\
|
||||||
$perl\
|
$perl\
|
||||||
$python \
|
$python \
|
||||||
|
${custom.venv}\
|
||||||
$ruby\
|
$ruby\
|
||||||
$rust\
|
$rust\
|
||||||
$terraform\
|
$terraform\
|
||||||
@ -86,9 +87,14 @@ command = "~/.config/starship/kubernetes.sh"
|
|||||||
when = 'test -n "$(/Users/errol/.config/starship/kubernetes.sh)"'
|
when = 'test -n "$(/Users/errol/.config/starship/kubernetes.sh)"'
|
||||||
format = "[ *$output* ](blue bold)"
|
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]
|
[python]
|
||||||
format = '[${symbol}${pyenv_prefix}(\($virtualenv\))]($style)'
|
format = '[${symbol}]($style)'
|
||||||
|
symbol = '🐍'
|
||||||
|
|
||||||
# [status]
|
# [status]
|
||||||
# disabled = false
|
# disabled = false
|
||||||
|
20
starship/.config/starship/venv.sh
Executable file
20
starship/.config/starship/venv.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user