Re: Commandline manual lookup script like perldoc for PHP

From: Date: Mon, 21 Apr 2003 23:53:33 +0000
Subject: Re: Commandline manual lookup script like perldoc for PHP
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-15299@lists.php.net to get a copy of this message
As Gabor mentioned, you could use the original XML files and parse that instead of screen-scrapping the information. This should be more reliable. BTW, if you do need a quick-ref like input file, you could modify some of the scripts at: http://cvs.php.net/cvs.php/phpdoc/scripts/ You can even imagine that you could optimize the distribution of the output file by either compressing it, and using a the zlib functions in PHP, or putting it into a DBM file, with the function name as a the index. BTW, the documentation tree for the english version starts at: http://cvs.php.net/cvs.php/phpdoc/en/ --- Stefan Walk <post@fuer-et.de> wrote: > Hi! > > Is there interest in a possibility do do commandline lookups of the PHP > Manual? (Well, i know i'm interested, that's why i wrote it ;)). A quick > search in google and PEAR didn't show anything, so i sat down for a bit > and wrote a first version of phpi that allows me to retrieve function > syntax quickly without switching to the browser. > Sample session: > > et@edea:~$ phpi > phpi: Commandline interface to the PHP manual, Version 0.0.1 > Usage: phpi [{-f functionname | --function=functionname}] [{-c | > --color}] [--version] [--usage] [{-l | --long}] > et@edea:~$ phpi -f strcpn > Error: Function not found, or unable to parse page! > et@edea:~$ phpi --function=strcspn > PHP function: strcspn > Versions: PHP 3>= 3.0.3, PHP 4 > Usage: int strcspn ( string str1, string str2) > Description: Find length of initial segment not matching mask > et@edea:~$ phpi -f strcspn -l > PHP function: strcspn > Versions: PHP 3>= 3.0.3, PHP 4 > Usage: int strcspn ( string str1, string str2) > Description: Find length of initial segment not matching mask > More Information: > Returns the length of the initial segment of str1 which does not contain > any of the characters in str2 . > See also strspn() . > et@edea:~$ > > It is currently only written as a quick hack and is not well documented, > but if there's interest, i'd be glad to clean it up, document it and > commit it into pear. It's by far not perfect as it is now, f.e. it fails > to get any information about include or require. For ordinary functions > it works though almost all the time. You can use colors to format the > output, using a package that i wrote independently of this. > > Another thing: The hardest part is parsing the manual. Currently I only > know of a printer-friendly version, not of a parser-friendly one. A > plaintext version, formatted with spaces, newlines (and tabs perhaps) > would really help. Is it possible to create such a version? > > ATM, phpi is fetching the pages from the net everytime. I'll change that > so one can download a manual version and use it instead (and provide > commandline options like --update-manual for easy maintaining) > > Source Code can be viewed at: > http://fuer-et.de/source/show_source.php?phpi > http://fuer-et.de/source/show_source.php?phpi-functions.php > http://fuer-et.de/source/show_source.php?Console_Colors.php > > phpi requires the PEAR packages HTTP_Request and Console_Getopt. > -l, --long isn't supported very good - the display can and will look > ugly sometimes. That's another thing on the todo, just like support for > other languages. > > So, to sum it up: > Does a script like this already exist and did i do this in vain? ;) > Is there interest for further development of this? > Should it be in PEAR? > Is it possible to provide a plaintext version of the manual? > (If there was a pure-PHP XML parser in PEAR, i could use the xml files > from CVS, but a) there is none and b) That would make searching hard, > when using phpi online.) > > Regards, > Stefan Walk > > -- > PEAR Development Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ===== --- Jesus M. Castagnetto (jcastagnetto@yahoo.com) Research: http://metallo.scripps.edu/ Personal: http://www.castagnetto.org/ __________________________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo http://search.yahoo.com

« previous php.pear.dev (#15299) next »