diff --git a/bin/tmuxinator.bash b/bin/tmuxinator.bash index 70c047d..476d1e2 100755 --- a/bin/tmuxinator.bash +++ b/bin/tmuxinator.bash @@ -2,18 +2,21 @@ _tmuxinator() { COMPREPLY=() - local word="${COMP_WORDS[COMP_CWORD]}" + local word + word="${COMP_WORDS[COMP_CWORD]}" if [ "$COMP_CWORD" -eq 1 ]; then local commands="$(compgen -W "$(tmuxinator commands)" -- "$word")" local projects="$(compgen -W "$(tmuxinator completions start)" -- "$word")" COMPREPLY=( $commands $projects ) - else - local words=("${COMP_WORDS[@]}") + elif [ "$COMP_CWORD" -eq 2 ]; then + local words + words=("${COMP_WORDS[@]}") unset words[0] unset words[$COMP_CWORD] - local completions=$(tmuxinator completions "${words[@]}") + local completions + completions=$(tmuxinator completions "${words[@]}") COMPREPLY=( $(compgen -W "$completions" -- "$word") ) fi }