Fix backwards compatibility calls to _known_hosts
This mimics the old behaviour where you could reuse `_known_hosts()' as a helper function and pass it `-a' or `-c'. NOTE: Using `_known_hosts' as a helper function and passing options to `_known_hosts' is deprecated: Use `_known_hosts_real' instead.
This commit is contained in:
parent
ddb0571227
commit
6d31b15011
@ -1052,10 +1052,14 @@ shopt -u hostcomplete && complete -F _user_at_host $nospace talk ytalk finger
|
|||||||
# `_known_hosts_real' instead.
|
# `_known_hosts_real' instead.
|
||||||
_known_hosts()
|
_known_hosts()
|
||||||
{
|
{
|
||||||
|
local options
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
|
|
||||||
# NOTE: Passing "$@" is deprecated. See NOTE above.
|
# NOTE: Using `_known_hosts' as a helper function and passing options
|
||||||
_known_hosts_real "$@" "$(_get_cword)"
|
# to `_known_hosts' is deprecated: Use `_known_hosts_real' instead.
|
||||||
|
[ "$1" = -a ] || [ "$2" = -a ] && options=-a
|
||||||
|
[ "$1" = -c ] || [ "$2" = -c ] && options="$options -c"
|
||||||
|
_known_hosts_real $options "$(_get_cword)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Helper function for completing _known_hosts.
|
# Helper function for completing _known_hosts.
|
||||||
|
3
test/completion/ping.exp
Normal file
3
test/completion/ping.exp
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
if {[assert_bash_type ping]} {
|
||||||
|
source "lib/completions/ping.exp"
|
||||||
|
}; # if
|
20
test/lib/completions/ping.exp
Normal file
20
test/lib/completions/ping.exp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
proc setup {} {
|
||||||
|
save_env
|
||||||
|
}; # setup()
|
||||||
|
|
||||||
|
|
||||||
|
proc teardown {} {
|
||||||
|
assert_env_unmodified
|
||||||
|
}; # teardown()
|
||||||
|
|
||||||
|
|
||||||
|
setup
|
||||||
|
|
||||||
|
|
||||||
|
assert_complete_any "ping "
|
||||||
|
|
||||||
|
|
||||||
|
sync_after_int
|
||||||
|
|
||||||
|
|
||||||
|
teardown
|
Loading…
x
Reference in New Issue
Block a user