Commandline manual lookup script like perldoc for PHP

From: Date: Mon, 21 Apr 2003 20:31:42 +0000
Subject: Commandline manual lookup script like perldoc for PHP
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-15285@lists.php.net to get a copy of this message
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

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