Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 92d25ef

Browse files
committed
DRY up logic when listing rubies.
1 parent 40e2afd commit 92d25ef

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

share/chruby/chruby.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ function chruby()
4848
echo "usage: chruby [RUBY|VERSION|system] [RUBY_OPTS]"
4949
;;
5050
"")
51+
local star
52+
5153
for ruby_path in ${RUBIES[@]}; do
52-
if [[ "$ruby_path" == "$RUBY" ]]; then
53-
echo -n " * "
54-
else
55-
echo -n " "
54+
if [[ "$ruby_path" == "$RUBY" ]]; then star="*"
55+
else star=" "
5656
fi
5757
58-
echo `basename "$ruby_path"`
58+
echo " $star $(basename "$ruby_path")"
5959
done
6060
;;
6161
system) chruby_reset ;;

0 commit comments

Comments
 (0)