Now it might complain that your PEAR needs updating, in which case you can usually just follow the suggestions to update and then try again. Once done, you can then access all the PHP documentation right from your command-line. Eg:$ pear install doc.php.net/pman
There is an apropos(1) option, but it doesn't work and apparently never will because all the PHP man pages have "junk descriptions" (according to makewhatis) So to find functions, googling or searching php.net is going to be faster. Alternatively I've created this little script which can help: (save it as "pman" and put it somewhere in your PATH ahead of /usr/bin)$ pman preg_match
So now, if you run:#! /bin/bash # a pman replacement # show php man page as per normal # but if no exact man page, list all man pages with matching text MAN=`which man` $MAN -M /usr/lib/php/pear/docs/pman/ $* if [ $? -ne 0 ]; then echo "" echo "Listing commands matching: $*" cmds=$( ls /usr/lib/php/pear/docs/pman/man3 | grep "$*" | sed 's/.[0-9].gz//' ) select cmd in $cmds do $MAN -M /usr/lib/php/pear/docs/pman/ $cmd break done fi
it will show the man page as usual. But if you run say:$ pman some_man_page
you get:$ pman tags
Now you can just type the number (in this case 1 or 2) to see the man page.No manual entry for tags Listing commands matching: tags 1) get_meta_tags 2) strip_tags #?
BTW, if you check, you'll see that all pman does is this:
Which means all you have to do is add something like:#!/bin/sh MAN=`which man` $MAN -M /usr/lib/php/pear/docs/pman/ $*
to your Shell startup file and you'll be able to access the PHP man pages with man just like any other man page.export MANPATH=/usr/share/man:/usr/lib/php/pear/docs/pman
No comments:
Post a Comment