zsh: complete users in ssh URLS
authorBrendan Cully <brendan@kublai.com>
Tue, 31 Oct 2006 16:04:03 -0800
changeset 3602 ec221317e018
parent 3601 cedf056bb723
child 3603 ef9c515836ae
zsh: complete users in ssh URLS
contrib/zsh_completion
--- a/contrib/zsh_completion	Tue Oct 31 15:48:02 2006 -0800
+++ b/contrib/zsh_completion	Tue Oct 31 16:04:03 2006 -0800
@@ -190,7 +190,8 @@
       typeset -a remdirs
       compset -p $(( $#host + 1 ))
       local rempath=${(M)PREFIX##*/}
-      local cacheid="hg_${host}_${rempath//\//_}"
+      local cacheid="hg:${host}-${rempath//\//_}"
+      cacheid=${cacheid%[-_]}
       compset -P '*/'
       if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid"
       then
@@ -202,7 +203,13 @@
       _message 'remote directory'
     fi
   else
-    _hosts -S/
+    if compset -P '*@'
+    then
+      _hosts -S/
+    else
+      _alternative 'hosts:remote host name:_hosts -S/' \
+        'users:user:_users -S@'
+    fi
   fi
 }