Tweak README
[abduco.git] / contrib / abduco.zsh
blobe8e94d15eeb2a533dc3aebb997d84b332d553d4e
1 #compdef abduco
3 typeset -A opt_args
5 _abduco_sessions() {
6 declare -a sessions
7 sessions=( $(abduco | sed '1d;s/.*\t[0-9][0-9]*\t//') )
8 _describe -t session 'session' sessions
11 _abduco_firstarg() {
12 if (( $+opt_args[-a] || $+opt_args[-A] )); then
13 _abduco_sessions
14 elif (( $+opt_args[-c] || $+opt_args[-n] )); then
15 _guard "^-*" 'session name'
16 elif [[ -z $words[CURRENT] ]]; then
17 compadd "$@" -S '' -- -
21 _arguments -s \
22 '(-a -A -c -n -f)-a[attach to an existing session]' \
23 '(-a -A -c -n)-A[attach to a session, create if does not exist]' \
24 '(-a -A -c -n -l)-c[create a new session and attach to it]' \
25 '(-a -A -c -n -l)-n[create a new session but do not attach to it]' \
26 '-e[set the detachkey (default: ^\\)]:detachkey' \
27 '(-a)-f[force create the session]' \
28 '(-q)-p[pass-through mode]' \
29 '-q[be quiet]' \
30 '-r[read-only session, ignore user input]' \
31 '(-c -n)-l[attach with the lowest priority]' \
32 '(-)-v[show version information and exit]' \
33 '1: :_abduco_firstarg' \
34 '2:command:_path_commands' \
35 '*:: :{ shift $((CURRENT-3)) words; _precommand; }'