]>
git.r.bdr.sh - rbdr/dotfiles/blob - zsh/functions/status.zsh
690b2eaf8bf51a365f4471e9dfb8156529652b18
1 function tool_versions
() {
2 if [[ -s ".tool-versions" ]]; then
6 echo "${HOME}/.tool-versions"
9 function env_info_provider
() { echo "%{%F{green}%}n/a"; }
11 echo "[%{%F{cyan}%}ENV%{%F{black}%} $(env_info_provider)%{%F{black}%}]"
14 function python_info
{
15 pythoninfo
=`cat "$(tool_versions)" | rg python | cut -d ' ' -f 2`
16 pythoninfo
=${ASDF_PYTHON_VERSION:-$pythoninfo}
17 venv
="${VIRTUAL_ENV##*/}"
18 echo "%{%F{green}%}py%{%F{black}%} ${pythoninfo:-no}@${venv:-default}"
22 rustinfo
=`cat "$(tool_versions)" | rg rust | cut -d ' ' -f 2`
23 rustinfo
=${ASDF_RUST_VERSION:-$rustinfo}
24 echo "%{%F{red}%}rs%{%F{black}%} ${rustinfo:-no}"
28 nodeinfo
=`cat "$(tool_versions)" | rg nodejs | cut -d ' ' -f 2`
29 nodeinfo
=${ASDF_NODEJS_VERSION:-$nodeinfo}
30 echo "%{%F{yellow}%}js%{%F{black}%} ${nodeinfo:-no}"
34 branch
=$(git branch --show-current 2> /dev/null)
36 if [ ! -z $branch ]; then
37 echo -n "@%F{cyan}$branch%f"
39 status_output
=$(git status --short)
41 if echo "$status_output" | rg
-q '^??'; then
42 echo -n "%{%F{magenta}%}?%f"
45 if echo "$status_output" | rg
-q '^ M'; then
46 echo -n "%{%F{magenta}%}!%f"
49 if echo "$status_output" | rg
-q '^ D'; then
50 echo -n "%{%F{magenta}%}×%f"
53 if echo "$status_output" | rg
-q '^A '; then
54 echo -n "%{%F{green}%}+%f"
60 echo '%{%F{black}%}$(env_info) $(node_info) $(rust_info) $(python_info)'