`_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)
These are the tests (| = cursor position):
1. a b| should return b
2. a | should return nothing
3. a b|c should return b
4. a b\ c| should return b\ c
5. a 'b c| should return 'b c
6. a "b c| should return "b c
7. a b:c| should return c
8. a b:c| with WORDBREAKS -= : should return b:c
9. a -n| should return -n
Tests 5 & 6 yield "expected failures", see bugreport:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=474094 . At a first glance
this bugreport contains useful ideas, so anyone willing to try to make tests 5 &
6 pass, be sure to have a look there first.
To run the automated tests:
$ cd test && ./runUnit _get_cword.exp
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
- -F<TAB> (without a space) now also completes.
- Fixed error when completion -F with file containing spaces
- Call _filedir instead of _filedirs in sftp
NOTE: Because the ssh & sftp completions don't have `-o filenames' in
effect, _filedir won't escape spaces in filenames. This can be seen in
the tests as "expected failures (XFAIL)". See also:
http://lists.alioth.debian.org/pipermail/bash-completion-devel/2009-July/001766.html
To run the tests:
cd test && ./runCompletion ssh.exp scp.exp sftp.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.