From 1c9e691ffbd4e9f8834b5f7c7ee501a9d2c808b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20H=C3=B6ltje?= Date: Tue, 22 Feb 2011 19:17:36 -0500 Subject: [PATCH] 'rvm gemset list' now has a '=>' for the currently used gemset https://www.pivotaltracker.com/story/show/10325081 --- scripts/gemsets | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/gemsets b/scripts/gemsets index 3cbba66756..a948a8a9d5 100755 --- a/scripts/gemsets +++ b/scripts/gemsets @@ -225,10 +225,21 @@ gemset_list() if [[ -n "${rvm_ruby_string:-""}" ]] ; then - ls "${rvm_gems_path:-"$rvm_path/gems"}/" \ - | awk -F"${rvm_gemset_separator:-"@"}" \ - "/${rvm_ruby_string}${rvm_gemset_separator:-"@"}/{print \$2}" \ - 2>/dev/null + # What's the current gemset? + local current_gemset="${GEM_HOME:-}" + # We only care about the stuff to the right of the separator. + current_gemset="${current_gemset##*${rvm_gemset_separator:-@}}" + + # Figure out the active gemsets for this version. + for gemset in "${rvm_gems_path:-${rvm_path}/gems}/${rvm_ruby_string}${rvm_gemset_separator:-@}"* + do + gemset="${gemset##*${rvm_gemset_separator:-@}}" + if [[ "${gemset}" = "${current_gemset}" ]]; then + echo "=> ${gemset}" + else + echo " ${gemset}" + fi + done else rvm_error "\$rvm_ruby_string is not set!"