tmuxinator.bash 716 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env bash
  2. _tmuxinator() {
  3. COMPREPLY=()
  4. local word
  5. word="${COMP_WORDS[COMP_CWORD]}"
  6. if [ "$COMP_CWORD" -eq 1 ]; then
  7. local commands="$(compgen -W "$(tmuxinator commands)" -- "$word")"
  8. local projects="$(compgen -W "$(tmuxinator completions start)" -- "$word")"
  9. COMPREPLY=( $commands $projects )
  10. elif [ "$COMP_CWORD" -eq 2 ]; then
  11. local words
  12. words=("${COMP_WORDS[@]}")
  13. unset words[0]
  14. unset words[$COMP_CWORD]
  15. local completions
  16. completions=$(tmuxinator completions "${words[@]}")
  17. COMPREPLY=( $(compgen -W "$completions" -- "$word") )
  18. fi
  19. }
  20. complete -F _tmuxinator tmuxinator mux
  21. alias mux="tmuxinator"