function ruby_version()
{
if which rvm-prompt &> /dev/null; then
rvm-prompt i v g
else
if which ruby &> /dev/null; then
ruby -v | sed -E 's/.*ruby ([0-9]+\.[0-9]+\.[0-9]+).*/\1/'
fi
fi
}
function node_prompt_version {
if which node &> /dev/null; then
echo "%{$fg_bold[blue]%}node(%{$fg[red]%}$(node -v)%{$fg[blue]%}) %{$reset_color%}"
fi
}
RPS1='${PR_GREEN}%{$reset_color%} %{$fg_bold[blue]%}ruby(%{$fg[red]%}$(ruby_version)%{$fg[blue]%}) $(node_prompt_version)'
Last active
November 5, 2024 11:59
-
-
Save dthtien/0501c725af1b8a5a0125f35dcb1ad166 to your computer and use it in GitHub Desktop.
Show Ruby and Node versions in ZSH terminal.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment