autoload -Uz promptinit && promptinit
+function tool_versions() {
+ if [[ -s ".tool-versions" ]]; then
+ echo '.tool-versions'
+ return
+ fi
+ echo "${HOME}/.tool-versions"
+}
+
if [[ "$TERM" == (dumb|linux|*bsd*) ]] || (( $#prompt_argv < 1 )); then
prompt 'off'
fi
}
function python_info {
- pythoninfo=`asdf current python | sed 's/ */ /g' | cut -d ' ' -f 2`
- if [[ -z "$VIRTUAL_ENV" ]]; then
- venv="default"
- else
- venv="${VIRTUAL_ENV##*/}"
- fi
- echo "%{%F{green}%}py%{%F{black}%} ${pythoninfo}@${venv}"
+ pythoninfo=`cat "$(tool_versions)" | rg python | cut -d ' ' -f 2`
+ pythoninfo=${ASDF_PYTHON_VERSION:-$pythoninfo}
+ venv="${VIRTUAL_ENV##*/}"
+ echo "%{%F{green}%}py%{%F{black}%} ${pythoninfo:-no}@${venv:-default}"
}
function ruby_info {
- rubyinfo=`asdf current ruby | sed 's/ */ /g' | cut -d ' ' -f 2`
- echo "%{%F{red}%}rb%{%F{black}%} ${rubyinfo}"
+ rubyinfo=`cat "$(tool_versions)" | rg ruby | cut -d ' ' -f 2`
+ rubyinfo=${ASDF_RUBY_VERSION:-$rubyinfo}
+ echo "%{%F{red}%}rb%{%F{black}%} ${rubyinfo:-no}"
}
function node_info {
- 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 box_name {