[Bash-completion-commits] [bash-completion] 01/01: _filedir: Avoid some unnecessary work with -d
Ville Skyttä
scop-guest at moszumanska.debian.org
Sun May 10 21:21:11 UTC 2015
This is an automated email from the git hooks/post-receive script.
scop-guest pushed a commit to branch master
in repository bash-completion.
commit 40c764af57ea0cd0c5c5cebeba6c838230d30c93
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Mon May 11 00:19:57 2015 +0300
_filedir: Avoid some unnecessary work with -d
---
bash_completion | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/bash_completion b/bash_completion
index 8786463..3f786af 100644
--- a/bash_completion
+++ b/bash_completion
@@ -560,37 +560,37 @@ _quote_readline_by_ref()
#
_filedir()
{
- local IFS=$'\n' xspec
+ local IFS=$'\n'
_tilde "$cur" || return 0
local -a toks
- local quoted x tmp
+ local x tmp
- _quote_readline_by_ref "$cur" quoted
x=$( compgen -d -- "$cur" ) &&
while read -r tmp; do
toks+=( "$tmp" )
done <<< "$x"
if [[ "$1" != -d ]]; then
+ local 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=15306
- xspec=${1:+"!*.@($1|${1^^})"}
+ local xspec=${1:+"!*.@($1|${1^^})"}
x=$( compgen -f -X "$xspec" -- $quoted ) &&
while read -r tmp; do
toks+=( "$tmp" )
done <<< "$x"
- fi
-
- # If the filter failed to produce anything, try without it if configured to
- [[ -n ${COMP_FILEDIR_FALLBACK:-} && \
- -n "$1" && "$1" != -d && ${#toks[@]} -lt 1 ]] && \
- x=$( compgen -f -- $quoted ) &&
- while read -r tmp; do
- toks+=( "$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; do
+ toks+=( "$tmp" )
+ done <<< "$x"
+ fi
if [[ ${#toks[@]} -ne 0 ]]; then
# 2>/dev/null for direct invocation, e.g. in the _filedir unit test
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bash-completion/bash-completion.git
More information about the Bash-completion-commits
mailing list