_filedir: bash > 4 has the same behaviour regardless of $cur beginning with ' or not

This can be triggered when $cur is actually empty, like, for example, when _filedir
  is manually launched from the command line:

    $ _filedir in
    $ echo ${COMPREPLY[@]}
    test doc .git contrib

  i.e. it's only showing the directories, not showing the files we're looking for.
  After this commit:

    $ . bash_completion
    $ _filedir in
    $ echo ${COMPREPLY[@]}
    test doc .git contrib bash_completion.sh.in Makefile.in
    $

  Which is the expected behaviour.
This commit is contained in:
David Paleino 2010-02-09 10:59:47 +01:00
parent 6b30acc9ac
commit 00560a88b4

View File

@ -588,7 +588,7 @@ _filedir()
#
if [[ "$1" != -d ]]; then
xspec=${1:+"!*.$1"}
if [[ ${cur:0:1} == "'" && ${BASH_VERSINFO[0]} -ge 4 ]]; then
if [[ ${BASH_VERSINFO[0]} -ge 4 ]]; then
toks=( ${toks[@]-} $(
eval compgen -f -X \"\$xspec\" -- $quoted
) )