From b8bdb144d2a310632efb3bbd7dd78d4f296bc62f Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Wed, 5 Apr 2000 11:28:08 +0000 Subject: use basename of commands instead of $words[1] --- Completion/User/_ssh | 364 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 222 insertions(+), 142 deletions(-) (limited to 'Completion/User/_ssh') diff --git a/Completion/User/_ssh b/Completion/User/_ssh index 1c0d61beb..04ee5f2e2 100644 --- a/Completion/User/_ssh +++ b/Completion/User/_ssh @@ -1,152 +1,232 @@ -#compdef ssh ssh-add ssh-agent ssh-keygen +#compdef ssh slogin scp ssh-add ssh-agent ssh-keygen -local state lstate line ret=1 expl -typeset -A options +_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. + compadd $(ssh ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*) +} -case "$words[1]" in -ssh) - _arguments -s \ - '-a[disable forwarding of 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]' \ - '-i[select identity file]:SSH identity file:_files' \ - '-k[disable forwarding of kerberos tickets]' \ - '-l[specify login name]:login name:_users' \ - '-n[redirect stdin from /dev/null]' \ - '*-o[specify extra options]:option string:->option' \ - '-p[specify port on remote host]:port number on remote host:' \ - '-q[quiet operation]' \ - '-P[use non priviledged port]' \ - '-t[force pseudo-tty allocation]' \ - '-v[verbose mode]' \ - '-V[show version number]' \ - '-x[disable X11 forwarding]' \ - '-C[compress all data]' \ - '-L[specify local port forwarding]:local port forwarding:->forward' \ - '-R[specify remote port forwarding]:remote port forwarding:->forward' \ - ':remote host name:_hosts' \ - ':command: _command_names -e' \ - '*::args:->command' && ret=0 +_ssh () { + local curcontext="$curcontext" state lstate line ret=1 expl args tmp + typeset -A opt_args - while [[ -n "$state" ]]; do - lstate="$state" - state='' + args=() - 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)*) - compadd yes no && ret=0 - ;; - *(#i)cipher*) - _description expl 'encryption cipher' - compadd "$expl[@]" idea des 3des blowfish arcfour tss none && ret=0 - ;; - *(#i)globalknownhostsfile*) - _description expl 'global file with known hosts' - _files "$expl[@]" && ret=0 - ;; - *(#i)hostname*) - _description expl 'real host name to log into' - _hosts "$expl[@]" && ret=0 - ;; - *(#i)identityfile*) - _description 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*) - compadd yes no ask - ;; - *(#i)userknownhostsfile*) - _description expl 'user file with known hosts' - _files "$expl[@]" && ret=0 - ;; - *(#i)user*) - _description expl 'user to log in as' - _users "$expl[@]" && ret=0 - ;; - *(#i)xauthlocation*) - _description expl 'xauth program' - _files "$expl[@]" -g '*(*)' && ret=0 - ;; - esac - else - _description expl 'configure file option' - compadd "$expl[@]" -M 'm:{a-z}={A-Z}' -S ' ' - \ - BatchMode ClearAllForwardings Cipher Compres