If _filedir 'ext' returns nothing, just fallback to generic file completion. Patch by Clint Byrum (Debian: #619014, LP: #533985)

This commit is contained in:
David Paleino 2011-03-20 15:22:33 +01:00
parent a6354b8107
commit 14fc9f2965
2 changed files with 10 additions and 0 deletions

View File

@ -10,6 +10,10 @@ bash-completion (2.x)
[ Guillaume Rousse ] [ Guillaume Rousse ]
* added puppet completion, using work from Mathieu Parent (sathieudebian.org) * added puppet completion, using work from Mathieu Parent (sathieudebian.org)
[ David Paleino ]
* If _filedir 'ext' returns nothing, just fallback to generic
file completion. Patch by Clint Byrum (Debian: #619014, LP: #533985)
-- David Paleino <d.paleino@gmail.com> Sun, 06 Feb 2011 21:46:37 +0100 -- David Paleino <d.paleino@gmail.com> Sun, 06 Feb 2011 21:46:37 +0100
bash-completion (1.3) bash-completion (1.3)

View File

@ -659,6 +659,12 @@ _filedir()
xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"} xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"}
toks=( ${toks[@]-} $( compgen -f -X "$xspec" -- $quoted) ) toks=( ${toks[@]-} $( compgen -f -X "$xspec" -- $quoted) )
fi fi
# If the filter failed to produce anything, try without it
if [[ -n "$1" ]] && [[ "$1" != -d ]] && [[ ${#toks[@]} -lt 1 ]] ; then
toks=( ${toks[@]-} $( compgen -f -- $quoted) )
fi
[ ${#toks[@]} -ne 0 ] && _compopt_o_filenames [ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" ) COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )