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:
Freddy Vulto 2009-07-25 09:35:03 +02:00
parent ddb0571227
commit 6d31b15011
3 changed files with 29 additions and 2 deletions

View File

@ -1052,10 +1052,14 @@ shopt -u hostcomplete && complete -F _user_at_host $nospace talk ytalk finger
# `_known_hosts_real' instead.
_known_hosts()
{
local options
COMPREPLY=()
# NOTE: Passing "$@" is deprecated. See NOTE above.
_known_hosts_real "$@" "$(_get_cword)"
# NOTE: Using `_known_hosts' as a helper function and passing options
# 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.

3
test/completion/ping.exp Normal file
View File

@ -0,0 +1,3 @@
if {[assert_bash_type ping]} {
source "lib/completions/ping.exp"
}; # if

View 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