forked from zsh-users/zsh-completions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_attach
50 lines (43 loc) · 1.55 KB
/
_attach
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#compdef attach
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for attach (http://github.com/sorin-ionescu/attach).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Sorin Ionescu <[email protected]>
#
# ------------------------------------------------------------------------------
local state mode_values existing_sessions ret=1
mode_values=(
"none:disable redrawing"
"ctrl_l:use ctrl + l to redraw"
"winch:use sigwinch to redraw"
)
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 detached]' \
'(--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 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