From 14fc9f2965d24193655a77dbca10cad61d839336 Mon Sep 17 00:00:00 2001 From: David Paleino Date: Sun, 20 Mar 2011 15:22:33 +0100 Subject: [PATCH] If _filedir 'ext' returns nothing, just fallback to generic file completion. Patch by Clint Byrum (Debian: #619014, LP: #533985) --- CHANGES | 4 ++++ bash_completion | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGES b/CHANGES index eedac4e8..c1cf9648 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,10 @@ bash-completion (2.x) [ Guillaume Rousse ] * 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 Sun, 06 Feb 2011 21:46:37 +0100 bash-completion (1.3) diff --git a/bash_completion b/bash_completion index c4ae7c9f..4fc50351 100644 --- a/bash_completion +++ b/bash_completion @@ -659,6 +659,12 @@ _filedir() xspec=${1:+"!*.@($1|$(printf %s $1 | tr '[:lower:]' '[:upper:]'))"} toks=( ${toks[@]-} $( compgen -f -X "$xspec" -- $quoted) ) 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 COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )