[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 0f3a7ff2a57c89d489e86eecbc0dedc64b7c4703

Ville Skyttä ville.skytta at iki.fi
Sat Oct 23 20:04:04 UTC 2010


The following commit has been merged in the master branch:
commit 0f3a7ff2a57c89d489e86eecbc0dedc64b7c4703
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sat Oct 23 23:01:11 2010 +0300

    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.

diff --git a/CHANGES b/CHANGES
index 6c0b4ed..1a28407 100644
--- a/CHANGES
+++ b/CHANGES
@@ -14,8 +14,8 @@ bash-completion (2.x)
   * Add *.gif (Alioth: #312512), *.m2t (Alioth: #312770), *.3gpp, *.3gpp2,
     and *.awb to mplayer filename completions.
   * Add "short" tarball extensions to unxz, unlzma etc completions.
-  * Improve /etc/init.d/*, ipmitool, jar, mencoder, mkdir, mplayer, povray,     
-    rpmbuild, sqlite3, wodim, and general help parsing completions.
+  * Improve /etc/init.d/*, ipmitool, jar, man, mencoder, mkdir, mplayer,
+    povray, rpmbuild, sqlite3, wodim, and general help parsing completions.
   * Fix p4 and povray completions (Alioth: #312625).
   * Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions.
   * Recognize rpm query mode based on the --file, --group, --package, and
diff --git a/completions/man b/completions/man
index a3360b2..0cf3e2e 100644
--- a/completions/man
+++ b/completions/man
@@ -11,7 +11,7 @@ _man()
     mansect="@([0-9lnp]|[0-9][px]|3pm)"
 
     COMPREPLY=()
-    _get_comp_words_by_ref cur prev
+    _get_comp_words_by_ref -n : cur prev
 
     if [[ "$prev" == -l ]]; then
         _filedir $manext
@@ -66,6 +66,7 @@ _man()
         done
     fi
 
+    __ltrim_colon_completions "$cur"
     return 0
 }
 [ $USERLAND = GNU -o $UNAME = Darwin \
diff --git a/test/fixtures/_filedir/a b/i b/test/fixtures/man/man1/bar.1.bz2
similarity index 100%
copy from test/fixtures/_filedir/a b/i
copy to test/fixtures/man/man1/bar.1.bz2
diff --git a/test/fixtures/_filedir/a b/i b/test/fixtures/man/man1/foo.1
similarity index 100%
copy from test/fixtures/_filedir/a b/i
copy to test/fixtures/man/man1/foo.1
diff --git a/test/fixtures/_filedir/a b/i b/test/fixtures/man/man3/Bash::Completion.3pm.gz
similarity index 100%
copy from test/fixtures/_filedir/a b/i
copy to test/fixtures/man/man3/Bash::Completion.3pm.gz
diff --git a/test/lib/completions/man.exp b/test/lib/completions/man.exp
index 47a6575..e0056ca 100644
--- a/test/lib/completions/man.exp
+++ b/test/lib/completions/man.exp
@@ -1,4 +1,5 @@
 proc setup {} {
+    assert_bash_exec {export MANPATH=$TESTDIR/fixtures/man}
     save_env
 }
 
@@ -11,7 +12,19 @@ proc teardown {} {
 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

-- 
bash-completion



More information about the Bash-completion-commits mailing list