From 1f97a6ad01cba9983bcc0a30a21b5938b51a1e76 Mon Sep 17 00:00:00 2001 From: Ben O'Hara Date: Fri, 6 Jul 2012 10:46:51 +1000 Subject: [PATCH] Add completion for tmuxinator --- _tmuxinator | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 _tmuxinator diff --git a/_tmuxinator b/_tmuxinator new file mode 100644 index 0000000..75d6ab3 --- /dev/null +++ b/_tmuxinator @@ -0,0 +1,55 @@ +#compdef tmuxinator mux +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for tmuxinator (https://github.com/aziz/tmuxinator). +# +# Source: https://gist.github.com/2242920 +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * ser1zw (https://github.com/ser1zw) +# * Ben O'Hara (https://github.com/benohara) +# +# ------------------------------------------------------------------------------ +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et +# ------------------------------------------------------------------------------ + +_tmuxinator() { + local -a projects + projects=(`find $HOME/.tmuxinator/ -name \*.yml| awk -F/ '{print $NF}' | sed s:.yml::g`) + + local -a commands + commands=( + 'start:start a tmux session using project'\''s tmuxinator config' + 'open:create a new project file and open it in your editor' + 'copy:copy source_project project file to a new project called new_project' + 'delete:deletes the project called project_name' + 'implode:deletes all existing projects!' + 'list:list all existing projects' + 'doctor:look for problems in your configuration' + 'help:shows this help document' + 'version:shows tmuxinator version number' + ) + + if (( CURRENT == 2 )); then + _describe -t commands 'commands' commands + elif (( CURRENT == 3 )); then + case $words[2] in + copy|delete|open|start) + _arguments '*:projects:($projects)' + ;; + list) + _arguments '-v[verbose]' # FIXME: doesn't work well + ;; + esac + fi + + return 0 +} + +_tmuxinator \ No newline at end of file