contrib/bash_completion: add tab completion for some bookmark commands
authorSteve Losh <steve@stevelosh.com>
Thu, 17 Sep 2009 22:30:45 -0400
changeset 9460 552c5a5a3502
parent 9459 3b283adcc720
child 9461 cec9fb4e07a1
contrib/bash_completion: add tab completion for some bookmark commands
contrib/bash_completion
--- a/contrib/bash_completion	Thu Sep 17 22:28:47 2009 -0400
+++ b/contrib/bash_completion	Thu Sep 17 22:30:45 2009 -0400
@@ -278,6 +278,22 @@
 
 # Completion for commands provided by extensions
 
+# bookmarks
+_hg_bookmarks()
+{
+    local bookmarks="$("$hg" bookmarks --quiet 2>/dev/null )"
+    local IFS=$'\n'
+    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$bookmarks' -- "$cur"))
+}
+
+_hg_cmd_bookmarks()
+{
+    if [[ "$prev" = @(-d|--delete|-m|--rename) ]]; then
+        _hg_bookmarks
+        return
+    fi
+}
+
 # mq
 _hg_ext_mq_patchlist()
 {