[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Quilt-dev] bash_completion: support argument completion for partial com
From: |
Joe Green |
Subject: |
[Quilt-dev] bash_completion: support argument completion for partial commands |
Date: |
Wed, 14 Jul 2004 16:32:15 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 |
Sorry for the misfire.
Here's another small enhancement for bash_completion. It adds support
for argument completion for a partial command as long as it's unique.
Yes, you could just tab-complete the command :), but quilt accepts these
partial commands so it's nice for the completion script to handle them.
--
Joe Green <address@hidden>
MontaVista Software, Inc.
Source: MontaVista Software, Inc. (address@hidden)
Type: Enhancement
Description:
Complete options for a partial command as long as it's unique.
quilt will accept such a partial command as valid.
Index: quilt-0.34/bash_completion
===================================================================
--- quilt-0.34.orig/bash_completion 2004-07-11 16:32:13.000000000 +0000
+++ quilt-0.34/bash_completion 2004-07-14 23:02:42.000000000 +0000
@@ -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 [ address@hidden -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)