summary refs log tree commit diff
path: root/Completion/Unix/Command/_mosh
blob: aa97587bb6fd6ba729ed6fcc405c94403c6b677c (plain) (blame)
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
#compdef mosh

local curcontext="$curcontext" state line expl ret=1
local -a _comp_priv_prefix

_arguments -C \
  '(-)--help[display help information]' \
  '(-)--version[display version information]' \
  "--no-init[don't set terminal init string]" \
  '--ssh=[specify ssh command to setup session]:ssh command:_normal' \
  '--port=[specify server-side port range]:port:_sequence -n 2 -s \: _ports' \
  '(-a -n)--predict=[control speculative local echo]:mode:(adaptive always never)' \
  '(--predict -n)-a[synonym for --predict=always]' \
  '(--predict -a)-n[synonym for --predict=never]' \
  '--server[specify command to run server helper]:remote file:_files' \
  '--client[specify command to run client helper]:_command_names -e' \
  '1:remote host name:->userhost' \
  '*:::args:_normal' && ret=0

case $state in
  userhost)
    if compset -P '*@'; then
      _wanted hosts expl 'remote host name' _ssh_hosts && ret=0
    elif compset -S '@*'; then
      _wanted users expl 'login name' _combination -s '[:@]' my-accounts users-hosts users -S '' && ret=0
    else
      _alternative \
	'hosts:remote host name:_ssh_hosts' \
	'users:login name:_combination -s "[:@]" my-accounts users-hosts users -qS@' && ret=0
    fi
  ;;
esac

return ret