Created
October 11, 2009 01:31
-
-
Save Oshuma/207311 to your computer and use it in GitHub Desktop.
rvm-prompt.zsh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# zsh functions to grab the current ruby version info from RVM. | |
# Useful mainly in prompts (see http://skitch.com/oshuma/nni3k/zsh-prompt-git-clean). | |
# ~/.zshrc | |
# RPS1=$'Ruby v$(ruby_prompt_version)' | |
# Ruby Version Manager | |
if [ -s ~/.rvm/scripts/rvm ] ; then | |
source ~/.rvm/scripts/rvm | |
# Prompt function. Return the full version string. | |
function ruby_prompt_version_full { | |
version=$( | |
rvm info | | |
grep -m 1 'full_version' | | |
sed 's/^.*full_version:[ ]*//' | | |
sed 's/["]//g' | |
) || return | |
echo $version | |
} | |
# Prompt function. Return just the version number. | |
function ruby_prompt_version { | |
version=$( | |
rvm info | | |
grep -m 1 'version' | | |
sed 's/^.*version:[ ]*//' | | |
sed 's/["]//g' | |
) || return | |
echo $version | |
} | |
fi # Ruby Version Manager |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment