]> git.r.bdr.sh - rbdr/dotfiles/commitdiff
Simplify prompt functions
authorRuben Beltran del Rio <redacted>
Mon, 28 Jun 2021 18:10:41 +0000 (20:10 +0200)
committerRuben Beltran del Rio <redacted>
Mon, 28 Jun 2021 18:10:41 +0000 (20:10 +0200)
zsh/modules/prompt.zsh

index 2b7454d140f3d43a0195f1193a2278947b420cf0..a3051788869a112d3bdc88941f0dceb91aface45 100644 (file)
@@ -22,23 +22,19 @@ function env_info {
 }
 
 function python_info {
 }
 
 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`
+  venv="${VIRTUAL_ENV##*/}"
+  echo "%{%F{green}%}py%{%F{black}%} ${pythoninfo:-no}@${venv:-default}"
 }
 
 function ruby_info {
 }
 
 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`
+  echo "%{%F{red}%}rb%{%F{black}%} ${rubyinfo:-no}"
 }
 
 function node_info {
 }
 
 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`
+  echo "%{%F{yellow}%}js%{%F{black}%} ${nodeinfo:-no}"
 }
 
 function box_name {
 }
 
 function box_name {