From 4e79ba15f760284850fa42c4341eef2b87709c24 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Wed, 3 Aug 2011 20:44:29 -0500 Subject: [PATCH] Match style --- completions/rbenv.bash | 57 +++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/completions/rbenv.bash b/completions/rbenv.bash index 804ac2f..7843f6b 100644 --- a/completions/rbenv.bash +++ b/completions/rbenv.bash @@ -1,41 +1,36 @@ -_commands() -{ - local cur commands - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - commands="exec prefix rehash set-default set-local version versions\ - whence which" +_commands() { + local cur commands + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + commands="exec prefix rehash set-default set-local version versions\ + whence which" - COMPREPLY=( $( compgen -W "${commands}" -- ${cur} ) ) + COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) } -_rubies() -{ - local cur rubies - local ROOT=$HOME/.rbenv/versions - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - rubies=($ROOT/*) - # remove all but the final part of the name - rubies="${rubies[@]##*/}" +_rubies() { + local cur rubies + local ROOT="${HOME}/.rbenv/versions" + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + rubies=($ROOT/*) + # remove all but the final part of the name + rubies="${rubies[@]##*/}" - COMPREPLY=( $( compgen -W "${rubies}" -- ${cur} ) ) + COMPREPLY=( $( compgen -W "$rubies" -- $cur ) ) } -_rbenv() -{ - local cur prev - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" +_rbenv() { + local cur prev + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" - if [[ "${prev}" == set-default ]]; then - _rubies - else - _commands - fi + if [ "$prev" = "set-default" ]; then + _rubies + else + _commands + fi } complete -F _rbenv rbenv - -# vim: set ts=4 sw=4 tw=75 filetype=sh: \ No newline at end of file