Fixed(?) RVM gem list helper #411

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+5 −5
Split
View
@@ -36,9 +36,9 @@ function gems {
local current_ruby=`rvm-prompt i v p`
local current_gemset=`rvm-prompt g`
- gem list $@ | sed \
- -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
- -Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
- -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
- -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
+ gem list $@ | sed -E \
@jbhannah

jbhannah Jun 6, 2011

Contributor

The question is, does a single -E here apply to all following -e expressions?

@betawaffle

betawaffle Jun 6, 2011

Contributor

The -E is for OS X, If you can make this work on both I'd be happy.

@jbhannah

jbhannah Jun 7, 2011

Contributor

GNU sed does actually support -E for legacy reasons, but its normal equivalent is -r. We can either leave -E there, or set an options variable depending on the version of sed (BSD or GNU). I'll look into it.

+ -e "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
+ -e "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
+ -e "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
+ -e "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
}