[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-430-g2f90dc7

Ville Skyttä ville.skytta at iki.fi
Mon Sep 19 16:44:29 UTC 2011


The following commit has been merged in the master branch:
commit 2f90dc7ecf6a9c1ec57edbb40815c45d5a0075b2
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Mon Sep 19 19:42:52 2011 +0300

    Make _filedir's "fallback to everything" behavior optional, and off by default.
    
    Configuration variable: COMP_FILEDIR_FALLBACK
    http://thread.gmane.org/gmane.comp.shells.bash.completion.devel/3357

diff --git a/bash_completion b/bash_completion
index bb91f68..c20a3af 100644
--- a/bash_completion
+++ b/bash_completion
@@ -571,8 +571,9 @@ _filedir()
         toks+=( $( compgen -f -X "$xspec" -- $quoted ) )
     fi
 
-    # If the filter failed to produce anything, try without it
-    [[ -n "$1" && "$1" != -d && ${#toks[@]} -lt 1 ]] && \
+    # If the filter failed to produce anything, try without it if configured to
+    [[ -n ${COMP_FILEDIR_FALLBACK:-} && \
+        -n "$1" && "$1" != -d && ${#toks[@]} -lt 1 ]] && \
         toks+=( $( compgen -f -- $quoted ) )
 
     [ ${#toks[@]} -ne 0 ] && compopt -o filenames 2>/dev/null
diff --git a/doc/bash_completion.txt b/doc/bash_completion.txt
index 1d1e2cf..c6e53d4 100644
--- a/doc/bash_completion.txt
+++ b/doc/bash_completion.txt
@@ -30,6 +30,11 @@ Environment variables
     remotely checked-out files.  This requires passwordless access to the
     remote repository.  Default is unset.
 
+*COMP_FILEDIR_FALLBACK*::
+    If set and not null, completions that look for filenames based on their
+    "extensions" will fall back to suggesting all files if there are none
+    matching the sought ones.
+
 *COMP_IWLIST_SCAN*::
     If set and not null, `iwconfig` completion will try to complete on
     available wireless networks identifiers.  Default is unset.

-- 
bash-completion



More information about the Bash-completion-commits mailing list