_filedir: Fix overquoted argument to compgen -d (RedHat: #1171396)
parent
d423969756
commit
d2920b7e79
|
@ -568,7 +568,7 @@ _filedir()
|
||||||
local quoted x tmp
|
local quoted x tmp
|
||||||
|
|
||||||
_quote_readline_by_ref "$cur" quoted
|
_quote_readline_by_ref "$cur" quoted
|
||||||
x=$( compgen -d -- "$quoted" ) &&
|
x=$( compgen -d -- "$cur" ) &&
|
||||||
while read -r tmp; do
|
while read -r tmp; do
|
||||||
toks+=( "$tmp" )
|
toks+=( "$tmp" )
|
||||||
done <<< "$x"
|
done <<< "$x"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
proc setup {} {
|
proc setup {} {
|
||||||
assert_bash_exec {unset COMPREPLY cur}
|
assert_bash_exec {unset COMPREPLY cur}
|
||||||
assert_bash_exec {unset -f _f}
|
assert_bash_exec {unset -f _f _fd}
|
||||||
save_env
|
save_env
|
||||||
# Declare bash completion function `_f'
|
# Declare bash completion function `_f'
|
||||||
assert_bash_exec { \
|
assert_bash_exec { \
|
||||||
|
@ -16,6 +16,11 @@ proc setup {} {
|
||||||
_g() { local cur=$(_get_cword); unset COMPREPLY; _filedir e1; }; \
|
_g() { local cur=$(_get_cword); unset COMPREPLY; _filedir e1; }; \
|
||||||
complete -F _g g \
|
complete -F _g g \
|
||||||
}
|
}
|
||||||
|
# Declare bash completion function `_fd' to complete on dirs
|
||||||
|
assert_bash_exec { \
|
||||||
|
_fd() { local cur=$(_get_cword); unset COMPREPLY; _filedir -d; }; \
|
||||||
|
complete -F _fd fd \
|
||||||
|
}
|
||||||
# Create directories `a*b' and `a\b' only when not running on Cygwin/Windows;
|
# Create directories `a*b' and `a\b' only when not running on Cygwin/Windows;
|
||||||
# directories containing `*' or `\' aren't allowed on Cygwin/Windows
|
# directories containing `*' or `\' aren't allowed on Cygwin/Windows
|
||||||
if {! [is_cygwin]} {
|
if {! [is_cygwin]} {
|
||||||
|
@ -33,8 +38,8 @@ proc teardown {} {
|
||||||
assert_bash_exec {(cd $TESTDIR/tmp && rm -- a\*b/j && rmdir a\*b/ || true)}
|
assert_bash_exec {(cd $TESTDIR/tmp && rm -- a\*b/j && rmdir a\*b/ || true)}
|
||||||
}
|
}
|
||||||
assert_bash_exec {unset COMPREPLY cur}
|
assert_bash_exec {unset COMPREPLY cur}
|
||||||
assert_bash_exec {unset -f _f _g}
|
assert_bash_exec {unset -f _f _g _fd}
|
||||||
assert_bash_exec {complete -r f g}
|
assert_bash_exec {complete -r f g fd}
|
||||||
assert_env_unmodified {
|
assert_env_unmodified {
|
||||||
/OLDPWD/d
|
/OLDPWD/d
|
||||||
/OLD_CTYPE/d
|
/OLD_CTYPE/d
|
||||||
|
@ -260,4 +265,12 @@ if {
|
||||||
sync_after_int
|
sync_after_int
|
||||||
|
|
||||||
|
|
||||||
|
set test "completing fd a\\ should return a\\ b/"
|
||||||
|
set cmd "fd a\\ "
|
||||||
|
assert_complete_dir "a\\ b/" $cmd "$::srcdir/fixtures/_filedir" $test -nospace
|
||||||
|
|
||||||
|
|
||||||
|
sync_after_int
|
||||||
|
|
||||||
|
|
||||||
teardown
|
teardown
|
||||||
|
|
Loading…
Reference in New Issue