From b5adbef28f5d5cd65b67e24c96e44de7f55004d1 Mon Sep 17 00:00:00 2001 From: Michiel Scholten Date: Sat, 2 Aug 2014 09:07:48 +0200 Subject: [PATCH] Bash autocompletion for tmuxinator --- bin/tmuxinator.bash | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 bin/tmuxinator.bash diff --git a/bin/tmuxinator.bash b/bin/tmuxinator.bash new file mode 100755 index 0000000..70c047d --- /dev/null +++ b/bin/tmuxinator.bash @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +_tmuxinator() { + COMPREPLY=() + local 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[@]}") + unset words[0] + unset words[$COMP_CWORD] + local completions=$(tmuxinator completions "${words[@]}") + COMPREPLY=( $(compgen -W "$completions" -- "$word") ) + fi +} + +complete -F _tmuxinator tmuxinator mux