Blame | Last modification | View Log | RSS feed
# This is a copy of the _filedir function in bash_completion, included# and (re)defined separately here because some versions of Adobe# Reader, if installed, are known to override this function with an# incompatible version, causing various problems.## https://bugzilla.redhat.com/677446# http://forums.adobe.com/thread/745833_filedir(){local IFS=$'\n'_tilde "$cur" || returnlocal -a tokslocal x tmpx=$( compgen -d -- "$cur" ) &&while read -r tmp; dotoks+=( "$tmp" )done <<< "$x"if [[ "$1" != -d ]]; thenlocal quoted_quote_readline_by_ref "$cur" quoted# Munge xspec to contain uppercase version too# http://thread.gmane.org/gmane.comp.shells.bash.bugs/15294/focus=15306local xspec=${1:+"!*.@($1|${1^^})"}x=$( compgen -f -X "$xspec" -- $quoted ) &&while read -r tmp; dotoks+=( "$tmp" )done <<< "$x"# Try without filter if it failed to produce anything and configured to[[ -n ${COMP_FILEDIR_FALLBACK:-} && -n "$1" && ${#toks[@]} -lt 1 ]] && \x=$( compgen -f -- $quoted ) &&while read -r tmp; dotoks+=( "$tmp" )done <<< "$x"fiif [[ ${#toks[@]} -ne 0 ]]; then# 2>/dev/null for direct invocation, e.g. in the _filedir unit testcompopt -o filenames 2>/dev/nullCOMPREPLY+=( "${toks[@]}" )fi} # _filedir()