Commit dace87ae authored by Jesse B. Hannah's avatar Jesse B. Hannah
Browse files

Fix rbenv gems helper

Fixes gem versions with words (beta, pre) in the version or with
multiple installed versions not being highlighted, and compatibility
with GNU sed (related to robbyrussell/oh-my-zsh#1579).
parent 6e6cf430
...@@ -32,11 +32,11 @@ for rbenvdir in "${rbenvdirs[@]}" ; do ...@@ -32,11 +32,11 @@ for rbenvdir in "${rbenvdirs[@]}" ; do
function gems { function gems {
local rbenv_path=$(rbenv prefix) local rbenv_path=$(rbenv prefix)
gem list $@ | sed \ gem list $@ | sed -E \
-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \ -e "s/\([0-9a-z, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
-Ee "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \ -e "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
} }
function rbenv_prompt_info() { function rbenv_prompt_info() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment