diff contrib/zsh_completion @ 3602:ec221317e018

zsh: complete users in ssh URLS
author Brendan Cully <brendan@kublai.com>
date Tue, 31 Oct 2006 16:04:03 -0800
parents cedf056bb723
children ef9c515836ae
line wrap: on
line diff
--- 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
 }