contrib/bash_completion
changeset 935 925563ff1b18
parent 929 26bb67b7ec14
child 945 f15901d053e1
child 946 6d21a3488df9
child 948 ffb0665028f0
child 952 dbfabfcb485e
child 981 4f81068ed8cd
--- a/contrib/bash_completion
+++ b/contrib/bash_completion
@@ -19,6 +19,12 @@
     COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$paths" -- "$cur" ))
 }
 
+_hg_status()
+{
+    local files="$( hg status -$1 | cut -b 3- )"
+    COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$files" -- "$cur" ))
+}
+
 _hg_tags()
 {
     local tags="$(hg tags | sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')"
@@ -104,6 +110,24 @@
 	paths)
 	    _hg_paths
 	;;
+	add)
+	    _hg_status "u"
+	;;
+	commit)
+	    _hg_status "mra"
+	;;
+	remove)
+	    _hg_status "r"
+	;;
+	forget)
+	    _hg_status "a"
+	;;
+	diff)
+	    _hg_status "mra"
+	;;
+	revert)
+	    _hg_status "mra"
+	;;
 	clone)
 	    local count=$(_hg_count_non_option)
 	    if [ $count = 1 ]; then
@@ -126,4 +150,4 @@
 
 }
 
-complete -o filenames -F _hg hg
+complete -o default -F _hg hg