From 2a235698f6aebb693853e78b88536be4e90af90f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 29 Sep 2011 20:30:06 -0400 Subject: [PATCH] Add attach completion. --- _attach | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 _attach diff --git a/_attach b/_attach new file mode 100644 index 0000000..20f36eb --- /dev/null +++ b/_attach @@ -0,0 +1,50 @@ +#compdef attach +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for attach (http://github.com/sorin-ionescu/attach). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Sorin Ionescu +# +# ------------------------------------------------------------------------------ + +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 +