scripts/list in rvm-0.1.40 vs scripts/list in rvm-0.1.41
- old
+ new
@@ -1,15 +1,9 @@
#!/usr/bin/env bash
if [[ "$rvm_trace_flag" -eq 2 ]] ; then set -x ; export rvm_trace_flag ; fi
-# Query for valid rvm ruby strings
-# This is meant to be used with scripting.
-list_strings() {
- echo $(\ls $rvm_rubies_path)
-}
-
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)"
@@ -72,18 +66,30 @@
echo "${prefix}-t${tag/\//}"
unset prefix tag
done < <(svn list http://svn.ruby-lang.org/repos/ruby/tags/ | awk '/^v1_[8|9]/')
}
+# Query for valid rvm ruby strings
+# This is meant to be used with scripting.
+list_strings() {
+ echo $(\ls $rvm_rubies_path)
+}
+
+# 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() {
if [[ -z "$rvm_interactive" ]] || [[ -z "$TERM" ]] || [[ "unknown" = "$TERM" ]] ; then
cat "$rvm_config_path/known"
else
cat "$rvm_config_path/known" | ${PAGER:-less}
fi
}
+
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)"
@@ -126,10 +132,12 @@
# This is not meant to be used with scripting. This is for interactive mode usage only.
action="$(echo "$1" | awk '{print $1}')"
if [[ "known" = "$action" ]] ; then
list_known
+elif [[ "known_strings" = "$action" ]] ; then
+ list_known_strings
elif [[ "gemsets" = "$action" ]] ; then
list_gemsets
elif [[ "default" = "$action" ]] ; then
list_default
elif [[ -z "$action" ]] || [[ "rubies" = "$action" ]] ; then
@@ -137,9 +145,9 @@
elif [[ "strings" = "$action" ]] ; then
list_strings
elif [[ "ruby_svn_tags" = "$action" ]] ; then
list_ruby_svn_tags
else # help
- printf "\nUsage: rvm list {known,gemsets,default,rubies,strings}"
+ printf "\nUsage: rvm list {known,gemsets,default,rubies,strings,known_strings}"
fi
exit $?