refactored _filedir using quote_readline()
This commit is contained in:
parent
f6497298a4
commit
f98bd24da4
@ -257,23 +257,23 @@ _get_cword()
|
||||
#
|
||||
_filedir()
|
||||
{
|
||||
local IFS=$'\t\n' xspec #glob
|
||||
local IFS=$'\t\n' xspec
|
||||
|
||||
_expand || return 0
|
||||
|
||||
#glob=$(set +o|grep noglob) # save glob setting.
|
||||
#set -f # disable pathname expansion (globbing)
|
||||
|
||||
if [ "${1:-}" = -d ]; then
|
||||
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -d -- $cur ) )
|
||||
#eval "$glob" # restore glob setting.
|
||||
return 0
|
||||
local toks=( ) tmp
|
||||
while read -r tmp; do
|
||||
[[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
|
||||
done < <( compgen -d -- "$(quote_readline "$cur")" )
|
||||
|
||||
if [[ "$1" != -d ]]; then
|
||||
xspec=${1:+"!*.$1"}
|
||||
while read -r tmp; do
|
||||
[[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
|
||||
done < <( compgen -f -X "$xspec" -- "$(quote_readline "$cur")" )
|
||||
fi
|
||||
|
||||
xspec=${1:+"!*.$1"} # set only if glob passed in as $1
|
||||
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -f -X "$xspec" -- "$cur" ) \
|
||||
$( compgen -d -- "$cur" ) )
|
||||
#eval "$glob" # restore glob setting.
|
||||
COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
|
||||
}
|
||||
|
||||
# This function completes on signal names
|
||||
|
3
debian/changelog
vendored
3
debian/changelog
vendored
@ -3,8 +3,9 @@ bash-completion (20080617.4) UNRELEASED; urgency=low
|
||||
* Merged Ubuntu changes:
|
||||
- added quote(), quote_readline(), dequote() helper functions.
|
||||
- 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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user