scripts/list in rvm-0.1.41 vs scripts/list in rvm-0.1.42

- old
+ new

@@ -1,16 +1,20 @@ #!/usr/bin/env bash if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi +source "$rvm_scripts_path/utility" + list_gemsets() { - echo - ruby=$(command -v ruby) ; current_ruby="" - if [[ ! -z "$ruby" ]] && [[ ! -z "$(echo $ruby | awk '/rvm/')" ]] ; then - current_ruby="$(echo $ruby | xargs dirname | xargs dirname | xargs basename 2> /dev/null)" + if [[ "$(echo $rvm_ruby_args | awk '{print $2}')" = "strings" ]]; then + list_gemset_strings + return 0 fi + echo + current_ruby="$(__rvm_environment_identifier)" + printf "rvm gemsets\n" for version in $(\ls $rvm_gems_path/ 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}') ; do ruby_version_name="$(echo "$version" | awk -F"$rvm_gemset_separator" '{print $1}')" if [[ -n "$(echo $version | awk '/^jruby-/')" ]] ; then string="[ $($rvm_rubies_path/$ruby_version_name/bin/ruby -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]" @@ -73,10 +77,15 @@ list_strings() { echo $(\ls $rvm_rubies_path) } # This is meant to be used with scripting. +list_gemset_strings() { + \ls $rvm_gems_path/ 2>/dev/null | xargs -- basename | grep -v '^\(@\|doc$\|cache$\|system$\)' | sort +} + +# This is meant to be used with scripting. list_known_strings() { cat "$rvm_config_path/known" | sed -e 's/#.*$//g' -e 's/(//g' -e 's/)//g' | sort -r | uniq } list_known() { @@ -88,15 +97,13 @@ } list_rubies() { echo - ruby=$(command -v ruby) ; current_ruby="" - if [[ ! -z "$ruby" ]] && [[ ! -z "$(echo $ruby | awk '/rvm/')" ]] ; then - current_ruby="$(echo $ruby | xargs dirname | xargs dirname | xargs basename 2> /dev/null)" - fi + current_ruby="$(__rvm_environment_identifier | awk -F"$rvm_gemset_separator" '{print $1}')" + printf "rvm rubies\n" for version in $(\ls $rvm_rubies_path/ 2> /dev/null | awk '/[a-z]*-.*/ {print $NF}') ; do if [[ ! -z "$(echo $version | awk '/^jruby-/')" ]] ; then string="[ $($rvm_rubies_path/$version/bin/ruby -v | awk '{print $NF}' | sed -e 's/\[//' -e 's/\]//') ]" elif [[ ! -z "$(echo $version | awk '/^maglev-|^macruby-/')" ]] ; then @@ -146,8 +153,9 @@ list_strings elif [[ "ruby_svn_tags" = "$action" ]] ; then list_ruby_svn_tags else # help printf "\nUsage: rvm list {known,gemsets,default,rubies,strings,known_strings}" + false fi exit $?