diff contrib/bash_completion @ 9460:552c5a5a3502

contrib/bash_completion: add tab completion for some bookmark commands
author Steve Losh <steve@stevelosh.com>
date Thu, 17 Sep 2009 22:30:45 -0400
parents b5e9ed63913b
children fc493cb90bb1
line wrap: on
line diff
--- 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()
 {