1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2025-06-14 10:51:41 +00:00

[Fix #259] Add ruby-info function

This commit is contained in:
Sorin Ionescu
2012-09-06 23:06:50 -04:00
parent eceef765b7
commit e5a9bdc4b4
2 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,28 @@
#
# Displays Ruby information.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
local version
local version_format
local version_formatted
# Clean up previous $ruby_info.
unset ruby_info
typeset -gA ruby_info
if (( $+commands[rvm-prompt] )); then
version="$(rvm-prompt)"
elif (( $+commands[rbenv] )); then
version="$(rbenv version-name)"
fi
# Format version.
if [[ -n "$version" ]]; then
zstyle -s ':prezto:module:ruby' version 'version_format'
zformat -f version_formatted "$version_format" "v:$version"
ruby_info[version]="$version_formatted"
fi