refactored _filedir using quote_readline()

This commit is contained in:
David Paleino 2008-06-23 11:13:08 +02:00
parent f6497298a4
commit f98bd24da4
2 changed files with 14 additions and 13 deletions

View File

@ -257,23 +257,23 @@ _get_cword()
# #
_filedir() _filedir()
{ {
local IFS=$'\t\n' xspec #glob local IFS=$'\t\n' xspec
_expand || return 0 _expand || return 0
#glob=$(set +o|grep noglob) # save glob setting. local toks=( ) tmp
#set -f # disable pathname expansion (globbing) while read -r tmp; do
[[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
if [ "${1:-}" = -d ]; then done < <( compgen -d -- "$(quote_readline "$cur")" )
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -d -- $cur ) )
#eval "$glob" # restore glob setting. if [[ "$1" != -d ]]; then
return 0 xspec=${1:+"!*.$1"}
while read -r tmp; do
[[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
done < <( compgen -f -X "$xspec" -- "$(quote_readline "$cur")" )
fi fi
xspec=${1:+"!*.$1"} # set only if glob passed in as $1 COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -f -X "$xspec" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
#eval "$glob" # restore glob setting.
} }
# This function completes on signal names # This function completes on signal names

3
debian/changelog vendored
View File

@ -3,8 +3,9 @@ bash-completion (20080617.4) UNRELEASED; urgency=low
* Merged Ubuntu changes: * Merged Ubuntu changes:
- added quote(), quote_readline(), dequote() helper functions. - added quote(), quote_readline(), dequote() helper functions.
- fixed _get_cword() - fixed _get_cword()
- refactored _filedir using quote_readline()
-- David Paleino <d.paleino@gmail.com> Mon, 23 Jun 2008 11:09:09 +0200 -- David Paleino <d.paleino@gmail.com> Mon, 23 Jun 2008 11:12:28 +0200
bash-completion (20080617.3) unstable; urgency=low bash-completion (20080617.3) unstable; urgency=low