Merge pull request #60 from sorin-ionescu/attach

Add attach completion.
This commit is contained in:
Julien Nicoulaud 2011-09-29 23:12:10 -07:00
commit d46c34aee8
1 changed files with 50 additions and 0 deletions

50
_attach Normal file
View File

@ -0,0 +1,50 @@
#compdef attach
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for attach (http://github.com/sorin-ionescu/attach).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Sorin Ionescu <sorin.ionescu@gmail.com>
#
# ------------------------------------------------------------------------------
local state mode_values existing_sessions ret=1
mode_values=(
"none:Disable redrawing completely"
"ctrl_l:Send a ^L character if the terminal is in char-at-a-time mode to the program"
"winch:Send a WINCH signal to the program"
)
existing_sessions=($(_call_program session attach))
_arguments -C -s -S \
'(--list -l)'{--list,-l}'[List sessions]' \
'(--sockets -L)'{--sockets,-L}'[List sockets]' \
'(--session -s)'{--session=,-s+}'[Set the session name]:session' \
'(--char -c)'{--char=,-c+}'[Set the detach character (default: ^\\)]:char' \
'(--redraw -r)'{--redraw=,-r+}'[Set the redraw method (none, ctrl_l, or winch)]:mode:->mode' \
'(--detached -d)'{--detached,-d}'[Start the session detched]' \
'(--no-detach -D)'{--no-detach,-D}'[Disable detaching]' \
'(--no-suspend -Z)'{--no-suspend,-Z}'[Disable suspending]' \
'(--version -v)'{--version,-v}'[Display version and copyright]' \
'(--help -h)'{--help,-h}'[Display this help]' \
'(-)::args:->session-or-command' && ret=0
case "$state" in
(mode)
_describe -t mode 'redraw mode' mode_values && ret=0
;;
(session-or-command)
_describe -t 'session' 'sessions' existing_sessions && ret=0
_path_commands && ret=0
;;
esac
return $ret