Merge pull request #60 from sorin-ionescu/attach
Add attach completion.
This commit is contained in:
commit
d46c34aee8
|
@ -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
|
||||
|
Loading…
Reference in New Issue