From 4e1e82d04e0dd0bc9c3f88ee0900d7b7cbb53a53 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 15 Jul 2004 22:23:05 +0000 Subject: Complete options for a partial command as long as it's unique. quilt will accept such a partial command as valid. [Joe Green] --- bash_completion | 10 ++++++++-- 1 file 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) -- cgit