changeset 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 3b283adcc720
children cec9fb4e07a1
files contrib/bash_completion
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
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()
 {