Make man completion work with manpage names containing colons.

For example Perl module man pages often contain them.  While at it,
add a couple of unrelated man test cases.
This commit is contained in:
Ville Skyttä 2010-10-23 23:01:11 +03:00
parent 5d7a13e05b
commit 0f3a7ff2a5
6 changed files with 18 additions and 4 deletions

View File

@ -14,8 +14,8 @@ bash-completion (2.x)
* Add *.gif (Alioth: #312512), *.m2t (Alioth: #312770), *.3gpp, *.3gpp2, * Add *.gif (Alioth: #312512), *.m2t (Alioth: #312770), *.3gpp, *.3gpp2,
and *.awb to mplayer filename completions. and *.awb to mplayer filename completions.
* Add "short" tarball extensions to unxz, unlzma etc completions. * Add "short" tarball extensions to unxz, unlzma etc completions.
* Improve /etc/init.d/*, ipmitool, jar, mencoder, mkdir, mplayer, povray, * Improve /etc/init.d/*, ipmitool, jar, man, mencoder, mkdir, mplayer,
rpmbuild, sqlite3, wodim, and general help parsing completions. povray, rpmbuild, sqlite3, wodim, and general help parsing completions.
* Fix p4 and povray completions (Alioth: #312625). * Fix p4 and povray completions (Alioth: #312625).
* Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions. * Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions.
* Recognize rpm query mode based on the --file, --group, --package, and * Recognize rpm query mode based on the --file, --group, --package, and

View File

@ -11,7 +11,7 @@ _man()
mansect="@([0-9lnp]|[0-9][px]|3pm)" mansect="@([0-9lnp]|[0-9][px]|3pm)"
COMPREPLY=() COMPREPLY=()
_get_comp_words_by_ref cur prev _get_comp_words_by_ref -n : cur prev
if [[ "$prev" == -l ]]; then if [[ "$prev" == -l ]]; then
_filedir $manext _filedir $manext
@ -66,6 +66,7 @@ _man()
done done
fi fi
__ltrim_colon_completions "$cur"
return 0 return 0
} }
[ $USERLAND = GNU -o $UNAME = Darwin \ [ $USERLAND = GNU -o $UNAME = Darwin \

0
test/fixtures/man/man1/bar.1.bz2 vendored Normal file
View File

0
test/fixtures/man/man1/foo.1 vendored Normal file
View File

View File

View File

@ -1,4 +1,5 @@
proc setup {} { proc setup {} {
assert_bash_exec {export MANPATH=$TESTDIR/fixtures/man}
save_env save_env
} }
@ -11,7 +12,19 @@ proc teardown {} {
setup setup
assert_complete_any "man man" assert_complete "bar" "man b"
sync_after_int
assert_complete "fixtures/man/man1/foo.1" "man fixtures/man/man1/f"
sync_after_int
assert_complete "Bash::Completion" "man Bash::C"
sync_after_int sync_after_int