`_get_cword' is reverted to before commit f6497298.
This fixes unittest:
"a b:c| with WORDBREAKS -= : should return b:c"
(| = cursor position)
notably by restoring passing an argument to _get_cword to omit
characters from $COMP_WORDBREAKS.
At the end of `get_cword', `echo "$cur"' has been changed to `printf
"%s" "$cur"'. This fixes unittest:
"a -n| should return -n"
(| = cursor position)
This reverts commit 11d4d978876ceb58eaec5dcfd82fae7b9699acfd.
Avoiding breaking completion for the sudo'd command isn't as
straightforward as I thought.
See also bugreport Alioth #311614.
Added tests for the awk script processing IP numbers. To run the tests:
cd test
./runUnit _known_hosts_real.exp
./runCompletion ssh.exp scp.exp sftp.exp
Quote sed output ("\1") retrieving "GlobalKnownHostsFile/UserKnownHostsFile" to
prevent bash globbing of special characters, e.g. '*'.
Added unit test "Config file containing star (*) should work".
Added test library function `assert_bash_list()'.
To run unit tests:
cd test && ./runUnit _known_hosts_real.exp
`_known_hosts_real' will add hosts from HOSTFILE (compgen -A hostname), unless
`COMP_KNOWN_HOSTS_WITH_HOSTFILE' is set to an empty value.
To run the unit tests:
$ cd test && ./runUnit _known_hosts_real.exp
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.
Fixed `_known_hosts_real' to allow for multiple patterns in ssh config, e.g.:
Host foo.example.net bar.example.net
IFS was set to just newline (\n), whereas `compgen -W' relies on IFS
being space-tab-newline ( \t\n) to expand hostnames which are separated
by whitespace.
Tests are updated as well (added host `jar' to config). To run the tests:
./runUnit _known_hosts_real.exp
The original call to avahi-browse also had "-k", to avoid
lookups into avahi's services DB. We don't need the name
of the service, and if it contains ";", it may mistify
the result. But on Gentoo (at least), -k isn't available
(even if mentioned in the manpage), so...