Update tmuxinator completions

tmuxinator 0.6.10 provides a completions sub command to use for
completion purposes.
This commit is contained in:
Christopher Chow 2015-02-28 10:13:00 +11:00
parent 6cc78eb382
commit ae67d3c525
1 changed files with 10 additions and 28 deletions

View File

@ -3,51 +3,33 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for tmuxinator (https://github.com/aziz/tmuxinator). # Completion script for tmuxinator (https://github.com/tmuxinator/tmuxinator)
#
# Source: https://gist.github.com/2242920
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Authors # Authors
# ------- # -------
# #
# * ser1zw (https://github.com/ser1zw) # * Christopher Chow (https://github.com/Soliah)
# * Ben O'Hara (https://github.com/benohara)
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
_tmuxinator() { _tmuxinator() {
local -a projects local commands projects
projects=(`find $HOME/.tmuxinator/ -name \*.yml| awk -F/ '{print $NF}' | sed s:.yml::g`) commands=(${(f)"$(tmuxinator commands zsh)"})
projects=(${(f)"$(tmuxinator completions start)"})
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 if (( CURRENT == 2 )); then
_describe -t commands 'commands' commands _describe -t commands "tmuxinator subcommands" commands
_describe -t projects 'projects' projects _describe -t projects "tmuxinator projects" projects
elif (( CURRENT == 3 )); then elif (( CURRENT == 3)); then
case $words[2] in case $words[2] in
copy|delete|open|start) copy|debug|delete|open|start)
_arguments '*:projects:($projects)' _arguments '*:projects:($projects)'
;; ;;
list)
_arguments '-v[verbose]' # FIXME: doesn't work well
;;
esac esac
fi fi
return 0 return
} }
_tmuxinator _tmuxinator