about summary refs log tree commit diff
path: root/Completion/User/_ssh
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-01-15 09:11:31 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-01-15 09:11:31 +0000
commitca585f812b02071cc261fb9dbe463bab6f8be602 (patch)
treee90c1af1169132098b62207ced35fdf83607e910 /Completion/User/_ssh
parenta11115ecee1b5fc02b4b714561ffdbc2d2a3e622 (diff)
downloadzsh-ca585f812b02071cc261fb9dbe463bab6f8be602.tar.gz
zsh-ca585f812b02071cc261fb9dbe463bab6f8be602.tar.xz
zsh-ca585f812b02071cc261fb9dbe463bab6f8be602.zip
add `services', allowing easier re-use of (parts of) completion functions (13346)
Diffstat (limited to 'Completion/User/_ssh')
-rw-r--r--Completion/User/_ssh12
1 files changed, 8 insertions, 4 deletions
diff --git a/Completion/User/_ssh b/Completion/User/_ssh
index c6a6898f1..7e81123ef 100644
--- a/Completion/User/_ssh
+++ b/Completion/User/_ssh
@@ -1,9 +1,12 @@
-#compdef ssh slogin scp ssh-add ssh-agent ssh-keygen
+#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.
-  compadd $(ssh -a -x ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*)
+  local expl
+
+  _wanted files expl 'remote files' \
+      compadd $(ssh -a -x ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*)
 }
 
 _ssh () {
@@ -14,8 +17,8 @@ _ssh () {
 
   # ssh-opt is a pseudo-command used to complete ssh options for `scp -o'.
 
-  case "${words[1]:t}" in
-  ssh|slogin)
+  case "$service" in
+  ssh)
     args=(
       ':remote host name:->userhost'
       '(-):command: _command_names -e'
@@ -179,6 +182,7 @@ _ssh () {
       compset -q
       words=(ssh-opt "$words[@]" )
       (( CURRENT++ ))
+      service=ssh-opt
       _ssh
       return
     elif [[ -n "$state" ]]; then