[Bash-completion-devel] Bug#545411: "man cmd subcmd" now works; please update bash-completion accordingly

David Paleino d.paleino at gmail.com
Thu Sep 17 14:52:58 UTC 2009


Hi Josh,

On Sun, 06 Sep 2009 17:14:34 -0700, Josh Triplett wrote:

> "man cmd subcmd" (for instance, "man git clone") now works with current
> man-db.  Please consider updating bash-completion accordingly, so that
> "man git cl[TAB]" suggests "git clone" and "git clean" rather than
> manpages starting with "cl".

I've talked with the man-db maintainer, and he explained me how this
"subcommand" feature works.

In pratice, if you pass "foo bar" to man(1), it will
try /usr/share/man/man*/foo-bar.* first, then "foo" and "bar" separately.

Obviously, this is not very foolproof: in case of "man hg ssh", one wants to
read manuals for mercurial (hg) and ssh. *But* there's also "hg-ssh" available
(at least on my system), and that's not a hg subcommand.

$ man -w hg ssh
/usr/share/man/man8/hg-ssh.8.gz
$ LANG=C hg ssh 1>/dev/null
hg: unknown command 'ssh'
$

So, we could (*could*, haven't written a single line of code yet) provide some
completions, but not very foolproof:

$ whatis -w 'git-*' | awk '{print $1}' | sed -e "s/git-//g" | head -n3
add
am
annotate
$ whatis -w 'hg-*' | awk '{print $1}' | sed -e "s/hg-//g" | head -n3
ssh
$


I'll give it a try :)
David

-- 
 . ''`.  Debian maintainer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://snipr.com/qa_page
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20090917/a9a36167/attachment-0002.pgp>


More information about the Bash-completion-devel mailing list