zsh completion: bookmarks support
authorBrendan Cully <brendan@kublai.com>
Sun, 05 Sep 2010 13:37:17 -0700
changeset 12169 b62276658844
parent 12168 ff4597f521a4
child 12171 cc39d07d2212
zsh completion: bookmarks support
contrib/zsh_completion
--- a/contrib/zsh_completion	Sat Sep 04 01:32:01 2010 -0700
+++ b/contrib/zsh_completion	Sun Sep 05 13:37:17 2010 -0700
@@ -766,6 +766,31 @@
   ':revision:_hg_tags'
 }
 
+## extensions ##
+
+# bookmarks
+_hg_bookmarks() {
+  typeset -a bookmark bookmarks
+
+  _hg_cmd bookmarks | while read -A bookmark
+  do
+    if test -z ${bookmark[-1]:#[0-9]*}
+    then
+      bookmarks+=($bookmark[-2])
+    fi
+  done
+  (( $#bookmarks )) && _describe -t bookmarks 'bookmarks' bookmarks
+}
+
+_hg_cmd_bookmarks() {
+  _arguments -s -w : $_hg_global_opts \
+  '(--force -f)'{-f,--force}'[force]' \
+  '(--rev -r --delete -d --rename -m)'{-r+,--rev}'[revision]:revision:_hg_tags' \
+  '(--rev -r --delete -d --rename -m)'{-d,--delete}'[delete a given bookmark]' \
+  '(--rev -r --delete -d --rename -m)'{-m+,--rename}'[rename a given bookmark]:bookmark:_hg_bookmarks' \
+  ':bookmark:_hg_bookmarks'
+}
+
 # HGK
 _hg_cmd_view() {
   _arguments -s -w : $_hg_global_opts \