Skip to content

Commit

Permalink
Merge pull request #60 from sorin-ionescu/attach
Browse files Browse the repository at this point in the history
Add attach completion.
  • Loading branch information
nicoulaj committed Sep 30, 2011
2 parents 25d352c + 2a23569 commit d46c34a
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions _attach
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d46c34a

Please sign in to comment.