diff contrib/zsh_completion @ 3560:6106236bc4eb

zsh: support remote URLs
author Brendan Cully <brendan@kublai.com>
date Thu, 26 Oct 2006 22:28:33 -0700
parents 35b99f076d02
children c8494fcc9d39
line wrap: on
line diff
--- a/contrib/zsh_completion	Thu Oct 26 17:33:24 2006 -0700
+++ b/contrib/zsh_completion	Thu Oct 26 22:28:33 2006 -0700
@@ -154,18 +154,34 @@
     'files:missing files:_hg_missing'
 }
 
+_hg_urls() {
+  if compset -P bundle://
+  then
+    _files
+  elif [[ -prefix *: ]]
+  then
+    _urls
+  else
+    local expl
+    compset -S '[^:]*'
+    _wanted url-schemas expl 'URL schema' compadd -S '' - \
+      http:// https:// ssh:// bundle://
+  fi
+}
+
 _hg_paths() {
   typeset -a paths pnames
   _hg_cmd paths 2> /dev/null | while read -A pnames
   do
     paths+=($pnames[1])
   done
-  (( $#paths )) && _describe -t urls 'repository aliases' paths
+  (( $#paths )) && _describe -t path-aliases 'repository alias' paths
 }
 
 _hg_remote() {
-  _alternative 'urls:repository alias:_hg_paths' \
-    'directories:directory:_files -/'
+  _alternative 'path-aliases:repository alias:_hg_paths' \
+    'directories:directory:_files -/' \
+    'urls:URL schema:_hg_urls'
 }
 
 # Common options