summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Quinson <mquinson@debian.org>2004-07-15 22:23:05 +0000
committerMartin Quinson <mquinson@debian.org>2004-07-15 22:23:05 +0000
commit4e1e82d04e0dd0bc9c3f88ee0900d7b7cbb53a53 (patch)
treeeecfcb087d1cb8efb02279df5947f36c165d6833
parent907cfc1ba44f687118fb0a2b53bf2b4265b54202 (diff)
downloadquilt-4e1e82d04e0dd0bc9c3f88ee0900d7b7cbb53a53.tar.gz
Complete options for a partial command as long as it's unique.
quilt will accept such a partial command as valid. [Joe Green]
-rw-r--r--bash_completion10
1 files changed, 8 insertions, 2 deletions
diff --git a/bash_completion b/bash_completion
index a1b65ee..f0b5fbe 100644
--- a/bash_completion
+++ b/bash_completion
@@ -75,7 +75,7 @@ fi
_quilt_completion()
{
- local cur prev cmds
+ local cur prev cmds command_matches
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
@@ -99,8 +99,14 @@ _quilt_completion()
return 0
fi
+ # Accept a partial command if it's unique, because quilt will accept it.
+ command_matches=( $(compgen -W "$cmds" -- ${COMP_WORDS[1]}) )
+ if [ ${#command_matches[@]} -ne 1 ] ; then
+ return 0
+ fi
+
# Complete depending on options
- case ${COMP_WORDS[1]} in
+ case ${command_matches[0]} in
add)
case $prev in
-p)