[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 6d31b150110d1b1a3b3d789bb2cf197f09110267

Freddy Vulto (none) freddy at rebase.
Sat Jul 25 07:43:02 UTC 2009


The following commit has been merged in the master branch:
commit 6d31b150110d1b1a3b3d789bb2cf197f09110267
Author: Freddy Vulto <freddy at rebase.(none)>
Date:   Sat Jul 25 09:35:03 2009 +0200

    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.

diff --git a/bash_completion b/bash_completion
index c17a564..08d9f86 100644
--- a/bash_completion
+++ b/bash_completion
@@ -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.
diff --git a/test/completion/ping.exp b/test/completion/ping.exp
new file mode 100644
index 0000000..994751b
--- /dev/null
+++ b/test/completion/ping.exp
@@ -0,0 +1,3 @@
+if {[assert_bash_type ping]} {
+    source "lib/completions/ping.exp"
+}; # if
diff --git a/test/lib/completions/bc.exp b/test/lib/completions/ping.exp
similarity index 83%
copy from test/lib/completions/bc.exp
copy to test/lib/completions/ping.exp
index c437d03..b600849 100644
--- a/test/lib/completions/bc.exp
+++ b/test/lib/completions/ping.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "bc --"
+assert_complete_any "ping "
 
 
 sync_after_int

-- 
bash-completion



More information about the Bash-completion-commits mailing list