diff options
| author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-04-02 12:02:29 +0000 |
|---|---|---|
| committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-04-02 12:02:29 +0000 |
| commit | 31cf3a8ab474099e5d5eefe444b875d37c18a75f (patch) | |
| tree | 91481fe0c6d2ee601fd3ccc6e3096621077749d9 /Completion/Unix/Command | |
| parent | moved to Completion/Unix/Command/_ssh (diff) | |
| download | zsh-31cf3a8ab474099e5d5eefe444b875d37c18a75f.tar zsh-31cf3a8ab474099e5d5eefe444b875d37c18a75f.tar.gz zsh-31cf3a8ab474099e5d5eefe444b875d37c18a75f.tar.bz2 zsh-31cf3a8ab474099e5d5eefe444b875d37c18a75f.tar.lz zsh-31cf3a8ab474099e5d5eefe444b875d37c18a75f.tar.xz zsh-31cf3a8ab474099e5d5eefe444b875d37c18a75f.tar.zst zsh-31cf3a8ab474099e5d5eefe444b875d37c18a75f.zip | |
moved from Completion/User/_ssh
Diffstat (limited to 'Completion/Unix/Command')
| -rw-r--r-- | Completion/Unix/Command/_ssh | 254 |
1 files changed, 254 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh new file mode 100644 index 000000000..7e81123ef --- /dev/null +++ b/Completion/Unix/Command/_ssh @@ -0,0 +1,254 @@ +#compdef ssh slogin=ssh scp ssh-add ssh-agent ssh-keygen + +_remote_files () { + # This is extremely simple-minded; could parse "ls -F" output to do + # colorings and LIST_TYPES and so on, but I'm just not that ambitious. + local expl + + _wanted files expl 'remote files' \ + compadd $(ssh -a -x ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*) +} + +_ssh () { + local curcontext="$curcontext" state lstate line ret=1 expl args tmp + typeset -A opt_args + + args=() + + # ssh-opt is a pseudo-command used to complete ssh options for `scp -o'. + + case "$service" in + ssh) + args=( + ':remote host name:->userhost' + '(-):command: _command_names -e' + '*::args:->command' + ) + ;& + ssh-opt) + _arguments -C -s \ + '-a[disable forwarding of authentication agent connection]' \ + '-A[enables forwarding of the authentication agent connection]' \ + '-c[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)' \ + '-e[set escape character]:escape character (or `none'"'"'):' \ + '(-n)-f[go to background]' \ + '-g[allows remote hosts to connect to local forwarded ports]'\ + '-i[select identity file]:SSH identity file:_files' \ + '-k[disable forwarding of kerberos tickets]' \ + '-l[specify login name]:login name:_ssh_users' \ + '-n[redirect stdin from /dev/null]' \ + '-N[do not execute a remote command. (protocol version 2 only)]'\ + '*-o[specify extra options]:option string:->option' \ + '-p[specify port on remote host]:port number on remote host:_ports' \ + '-P[use non priviledged port]' \ + '-q[quiet operation]' \ + '-t[force pseudo-tty allocation]' \ + '-T[disable pseudo-tty allocation (protocol version 2 only)]'\ + '-v[verbose mode]' \ + '-V[show version number]' \ + '-x[disable X11 forwarding]' \ + '-X[enable X11 forwarding]' \ + '-C[compress all data]' \ + '-L[specify local port forwarding]:local port forwarding:->forward' \ + '-R[specify remote port forwarding]:remote port forwarding:->forward' \ + '-2[forces ssh to try protocol version 2 only]'\ + '-4[forces ssh to use IPv4 addresses only]' \ + '-6[forces ssh to use IPv6 addresses only]' \ + "$args[@]" && ret=0 + + while [[ -n "$state" ]]; do + lstate="$state" + state='' + + case "$lstate" in + option) + if compset -P '*[= ]'; then + case "$IPREFIX" in + *(#i)(batchmode|compression|fallbacktorsh|forward(agent|x11)|keepalive|passwordauthentication|rhosts(|rsa)authentication|rsaauthentication|usersh|kerberos(authetication|tgtparsing)|usepriviledgedport)*) + _wanted values expl 'truth value' compadd yes no && ret=0 + ;; + *(#i)cipher*) + _wanted values expl 'encryption cipher' \ + compadd idea des 3des blowfish arcfour tss none && ret=0 + ;; + *(#i)globalknownhostsfile*) + _description files expl 'global file with known hosts' + _files "$expl[@]" && ret=0 + ;; + *(#i)hostname*) + _wanted hosts expl 'real host name to log into' _ssh_hosts && ret=0 + ;; + *(#i)identityfile*) + _description files expl 'SSH identity file' + _files "$expl[@]" && ret=0 + ;; + *(#i)(local|remote)forward*) + state=forward + ;; + *(#i)proxycommand*) + compset -q + shift 1 words + (( CURRENT-- )) + _normal && ret=0 + ;; + *(#i)stricthostkeychecking*) + _wanted values expl 'checking type' compadd yes no ask && ret=0 + ;; + *(#i)userknownhostsfile*) + _description files expl 'user file with known hosts' + _files "$expl[@]" && ret=0 + ;; + *(#i)user*) + _wanted users expl 'user to log in as' _ssh_users && ret=0 + ;; + *(#i)xauthlocation*) + _description files expl 'xauth program' + _files "$expl[@]" -g '*(-*)' && ret=0 + ;; + esac + else + _wanted values expl 'configure file option' \ + compadd -M 'm:{a-z}={A-Z}' -S '=' - \ + BatchMode ClearAllForwardings Cipher Compression \ + CompressionLevel Host ConnectionAttempts EscapeChar \ + FallBackToRsh ForwardAgent ForwardX11 \ + GlobalKnownHostsFile HostName IdentityFile KeepAlive \ + KerberosAuthentication KerberosTgtPassing LocalForward \ + NumberOfPasswordPrompts PasswordAuthentication Port \ |
