changeset 12169:b62276658844

zsh completion: bookmarks support
author Brendan Cully <brendan@kublai.com>
date Sun, 05 Sep 2010 13:37:17 -0700
parents ff4597f521a4
children cc39d07d2212
files contrib/zsh_completion
diffstat 1 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 \