Skip to content

Commit

Permalink
Rewrite the chruby() function as a case statement.
Browse files Browse the repository at this point in the history
Fixes #17.
  • Loading branch information
havenwood committed Aug 12, 2015
1 parent ba7b7e3 commit e2b7661
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions share/chruby/chruby.fish
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,15 @@ end
# it, and capturing the outputted environment variables to be set in Fish.
#
function chruby
set -l version_commands '-V' '--version'
set -l external_commands '-h' '--help' $version_commands

if echo $external_commands | grep -qe "$argv[1]"
bchruby 'chruby' $argv

echo $version_commands | grep -qe "$argv[1]"; or return
echo 'chruby-fish:' $CHRUBY_FISH_VERSION
else if test -z "$argv"
bchruby 'chruby'
else if test $argv[1] = 'system'
chruby_reset
else
chruby_use $argv
return $status
switch "$argv[1]"
case '-h' '--help', ''
bchruby "chruby $argv"
case '-V' '--version'
bchruby "chruby $argv"
echo "chruby-fish: $CHRUBY_FISH_VERSION"
case 'system'
chruby_reset
case '*'
chruby_use "$argv"
end
end

0 comments on commit e2b7661

Please sign in to comment.