- nodeinfo=`asdf current nodejs | sed 's/ */ /g' | cut -d ' ' -f 2`
- echo "%{%F{yellow}%}js%{%F{black}%} ${nodeinfo}"
+ nodeinfo=`cat "$(tool_versions)" | rg nodejs | cut -d ' ' -f 2`
+ nodeinfo=${ASDF_NODEJS_VERSION:-$nodeinfo}
+ echo "%{%F{yellow}%}js%{%F{black}%} ${nodeinfo:-no}"
+}
+
+function git_info {
+ branch=$(git branch --show-current 2> /dev/null)
+
+ if [ ! -z $branch ]; then
+ echo -n "@%F{cyan}$branch%f"
+
+ status_output=$(git status --short)
+
+ if echo "$status_output" | grep -q '^??'; then
+ echo -n "%{%F{magenta}%}?%f"
+ fi
+
+ if echo "$status_output" | grep -q '^ M'; then
+ echo -n "%{%F{magenta}%}!%f"
+ fi
+
+ if echo "$status_output" | grep -q '^ D'; then
+ echo -n "%{%F{magenta}%}×%f"
+ fi
+
+ if echo "$status_output" | grep -q '^A '; then
+ echo -n "%{%F{green}%}+%f"
+ fi
+ fi