[PATCH] bash_completion: auto-grab debug commands
TK Soh
teekaysoh at yahoo.com
Tue Nov 22 00:42:32 UTC 2005
I noticed the debug commands are hardcoded somehow, so I thought it can be made
more convenient.
Also, I am checking for commands starting with "debug", since there might be some
"de*" commands some day.
# HG changeset patch
# User TK Soh <teekaysoh at yahoo.com>
# Node ID 1c59a989cb44ec99ec2cfab72fbe05162299abb6
# Parent 1265193397507efa9750d7f0cb483c88f22d5d92
bash_completion: auto-grab debug commands
diff -r 126519339750 -r 1c59a989cb44 contrib/bash_completion
--- a/contrib/bash_completion Mon Nov 21 08:39:26 2005 +0800
+++ b/contrib/bash_completion Tue Nov 22 08:39:58 2005 +0800
@@ -2,17 +2,20 @@
_hg_commands()
{
- local commands="$(hg -v help | sed -e '1,/^list of commands:/d' \
- -e '/^global options:/,$d' \
- -e '/^ [^ ]/!d; s/[,:]//g;')"
+ local commands
# hide debug commands from users, but complete them if
# specifically asked for
- if [[ "$cur" == de* ]]; then
- commands="$commands debugcheckstate debugstate debugindex"
- commands="$commands debugindexdot debugwalk debugdata"
- commands="$commands debugancestor debugconfig debugrename"
+ if [[ "$cur" == debug* ]]; then
+ commands="$(hg --debug help | sed -e '1,/^list of commands:/d' \
+ -e '/^global options:/,$d' \
+ -e '/^ debug/!d' -e's/[,:]//g;')"
+ else
+ commands="$(hg -v help | sed -e '1,/^list of commands:/d' \
+ -e '/^global options:/,$d' \
+ -e '/^ [^ ]/!d; s/[,:]//g;')"
fi
+
COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "$commands" -- "$cur") )
}
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
More information about the Mercurial
mailing list