Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Feature: Added 'rvm list known_strings', thanks to lenary for the idea.

  • Loading branch information...
commit 9a63b7bd110d238336ba3996764fba3ec21e0502 1 parent 5248693
@wayneeseguin wayneeseguin authored
Showing with 15 additions and 7 deletions.
  1. +15 −7 scripts/list
View
22 scripts/list
@@ -2,12 +2,6 @@
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=""
@@ -74,6 +68,17 @@ list_ruby_svn_tags() {
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"
@@ -82,6 +87,7 @@ list_known() {
fi
}
+
list_rubies() {
echo
ruby=$(command -v ruby) ; current_ruby=""
@@ -128,6 +134,8 @@ 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
@@ -139,7 +147,7 @@ elif [[ "strings" = "$action" ]] ; then
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 $?

2 comments on commit 9a63b7b

@lenary

thanks! that was quick!

@Sutto

Yah! this means I can remove the implementation I used in the ruby api. Also,
the ruby version has another option that expands the variables (so, it lists possible
strings not just the base) - I'll have to see if I can get that working with sed.

Please sign in to comment.
Something went wrong with that request. Please try again.