From d356ecb14bc4863f60c34e3f28fac48d278a7609 Mon Sep 17 00:00:00 2001 From: Hendrik Mans Date: Tue, 24 Jan 2012 14:30:01 +0100 Subject: [PATCH 1/3] Add rbfu support. Prompts can now display the currently active Ruby version set by rbfu, a tool similar to RVM and rbenv. --- themes/base.theme.bash | 9 +++++++++ themes/envy/envy.theme.bash | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 58efe11d..b763121a 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -27,6 +27,9 @@ VIRTUALENV_THEME_PROMPT_SUFFIX='|' RBENV_THEME_PROMPT_PREFIX=' |' RBENV_THEME_PROMPT_SUFFIX='|' +RBFU_THEME_PROMPT_PREFIX=' |' +RBFU_THEME_PROMPT_SUFFIX='|' + function scm { if [[ -d .git ]]; then SCM=$SCM_GIT elif [[ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]]; then SCM=$SCM_GIT @@ -123,6 +126,12 @@ function rbenv_version_prompt { fi } +function rbfu_version_prompt { + if [[ $RBFU_RUBY_VERSION ]]; then + echo -e "${RBFU_THEME_PROMPT_PREFIX}${RBFU_RUBY_VERSION}${RBFU_THEME_PROMPT_SUFFIX}" + fi +} + function virtualenv_prompt { if which virtualenv &> /dev/null; then virtualenv=$([ ! -z "$VIRTUAL_ENV" ] && echo "`basename $VIRTUAL_ENV`") || return diff --git a/themes/envy/envy.theme.bash b/themes/envy/envy.theme.bash index 6787434e..e9b7081f 100644 --- a/themes/envy/envy.theme.bash +++ b/themes/envy/envy.theme.bash @@ -10,7 +10,7 @@ GIT_THEME_PROMPT_PREFIX=" ${green}|" GIT_THEME_PROMPT_SUFFIX="${green}|" function prompt_command() { - PS1="\n${yellow}$(rbenv_version_prompt)$(rvm_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " + PS1="\n${yellow}$(rbfu_version_prompt)$(rbenv_version_prompt)$(rvm_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " } PROMPT_COMMAND=prompt_command; From 2e8be86f2b750617d9fc29005c8fbd12c25f2780 Mon Sep 17 00:00:00 2001 From: Hendrik Mans Date: Tue, 24 Jan 2012 14:31:23 +0100 Subject: [PATCH 2/3] Introduce $(ruby_version_prompt), wrapping around rbfu, rbenv and RVM support. --- themes/base.theme.bash | 4 ++++ themes/envy/envy.theme.bash | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index b763121a..503fc57b 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -132,6 +132,10 @@ function rbfu_version_prompt { fi } +function ruby_version_prompt { + echo -e "$(rbfu_version_prompt)$(rbenv_version_prompt)$(rvm_version_prompt)" +} + function virtualenv_prompt { if which virtualenv &> /dev/null; then virtualenv=$([ ! -z "$VIRTUAL_ENV" ] && echo "`basename $VIRTUAL_ENV`") || return diff --git a/themes/envy/envy.theme.bash b/themes/envy/envy.theme.bash index e9b7081f..d2f6a00b 100644 --- a/themes/envy/envy.theme.bash +++ b/themes/envy/envy.theme.bash @@ -10,7 +10,7 @@ GIT_THEME_PROMPT_PREFIX=" ${green}|" GIT_THEME_PROMPT_SUFFIX="${green}|" function prompt_command() { - PS1="\n${yellow}$(rbfu_version_prompt)$(rbenv_version_prompt)$(rvm_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " + PS1="\n${yellow}$(ruby_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " } PROMPT_COMMAND=prompt_command; From 1be4467429013470e16516b08fbcafa939bfd4bb Mon Sep 17 00:00:00 2001 From: Hendrik Mans Date: Thu, 26 Jan 2012 16:07:06 +0100 Subject: [PATCH 3/3] Update (most) themes to use new ${ruby_version_prompt} variable. --- themes/bobby/bobby.theme.bash | 4 ++-- themes/doubletime/doubletime.theme.bash | 2 +- themes/hawaii50/hawaii50.theme.bash | 2 +- themes/pete/pete.theme.bash | 2 +- themes/rainbowbrite/rainbowbrite.theme.bash | 4 ++-- themes/tylenol/tylenol.theme.bash | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/themes/bobby/bobby.theme.bash b/themes/bobby/bobby.theme.bash index cb51fb85..4d150106 100644 --- a/themes/bobby/bobby.theme.bash +++ b/themes/bobby/bobby.theme.bash @@ -13,8 +13,8 @@ RVM_THEME_PROMPT_PREFIX="|" RVM_THEME_PROMPT_SUFFIX="|" function prompt_command() { - #PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(rvm_version_prompt) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} " - PS1="\n${yellow}$(rvm_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " + #PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(ruby_version_prompt) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} " + PS1="\n${yellow}$(ruby_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " } PROMPT_COMMAND=prompt_command; diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index c3bf453d..c79ab5ec 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -50,7 +50,7 @@ function prompt_setter() { clock=$THEME_PROMPT_CLOCK_FORMAT fi PS1=" -$clock $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(rvm_version_prompt)\w +$clock $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(ruby_version_prompt)\w $(doubletime_scm_prompt)$reset_color $ " PS2='> ' PS4='+ ' diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 93cef469..0b1fe3bd 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -98,7 +98,7 @@ function ip_prompt_info() { # Displays virtual info prompt (virtualenv/rvm) function virtual_prompt_info() { local virtual_env_info=$(virtualenv_prompt) - local rvm_info=$(rvm_version_prompt) + local rvm_info=$(ruby_version_prompt) local virtual_prompt="" local prefix=${VIRTUAL_THEME_PROMPT_PREFIX} diff --git a/themes/pete/pete.theme.bash b/themes/pete/pete.theme.bash index 7b6702cf..cda451e1 100644 --- a/themes/pete/pete.theme.bash +++ b/themes/pete/pete.theme.bash @@ -5,7 +5,7 @@ prompt_setter() { history -a history -c history -r - PS1="(\t) $(scm_char) [$blue\u$reset_color@$green\H$reset_color] $yellow\w${reset_color}$(scm_prompt_info)$(rvm_version_prompt) $reset_color " + PS1="(\t) $(scm_char) [$blue\u$reset_color@$green\H$reset_color] $yellow\w${reset_color}$(scm_prompt_info)$(ruby_version_prompt) $reset_color " PS2='> ' PS4='+ ' } diff --git a/themes/rainbowbrite/rainbowbrite.theme.bash b/themes/rainbowbrite/rainbowbrite.theme.bash index e4424bbe..11792305 100644 --- a/themes/rainbowbrite/rainbowbrite.theme.bash +++ b/themes/rainbowbrite/rainbowbrite.theme.bash @@ -11,9 +11,9 @@ prompt_setter() { history -c history -r # displays user@server in purple - # PS1="$red$(scm_char) $purple\u@\h$reset_color:$blue\w$yellow$(scm_prompt_info)$(rvm_version_prompt) $black\$$reset_color " + # PS1="$red$(scm_char) $purple\u@\h$reset_color:$blue\w$yellow$(scm_prompt_info)$(ruby_version_prompt) $black\$$reset_color " # no user@server - PS1="$red$(scm_char) $blue\w$yellow$(scm_prompt_info)$(rvm_version_prompt) $black\$$reset_color " + PS1="$red$(scm_char) $blue\w$yellow$(scm_prompt_info)$(ruby_version_prompt) $black\$$reset_color " PS2='> ' PS4='+ ' } diff --git a/themes/tylenol/tylenol.theme.bash b/themes/tylenol/tylenol.theme.bash index c915f561..d8b63efb 100644 --- a/themes/tylenol/tylenol.theme.bash +++ b/themes/tylenol/tylenol.theme.bash @@ -14,7 +14,7 @@ VIRTUALENV_THEME_PROMPT_PREFIX='|' VIRTUALENV_THEME_PROMPT_SUFFIX='|' function prompt_command() { - PS1="\n${green}$(virtualenv_prompt)${red}$(rvm_version_prompt) ${reset_color}\h ${orange}in ${reset_color}\w\n${yellow}$(scm_char)$(scm_prompt_info) ${yellow}→${white} " + PS1="\n${green}$(virtualenv_prompt)${red}$(ruby_version_prompt) ${reset_color}\h ${orange}in ${reset_color}\w\n${yellow}$(scm_char)$(scm_prompt_info) ${yellow}→${white} " } PROMPT_COMMAND=prompt_command;