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
master
Ville Skyttä 2011-09-19 19:42:52 +03:00
parent bae27caab0
commit 2f90dc7ecf
2 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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.