Easy Documentation for Git, MySQL, PHP, et cetera

This is what I do on my box to quickly find documentation, which you guys may find helpful.  Especially those of you on Linux—although you could do this on Windows too.

Most package managers make available ‘-doc’ packages, like php-doc, mysql-doc, and so on.  Install these for all the major software you use.

Next, install ‘screen’.

Now put this is your Bash config:

  1. # Displays various types of documentation.
  2.  
  3. function doc() {
  4.     case "$1" in
  5.     ‘llvm’)
  6.         screen -t ‘LLVM Documentation’ w3m /usr/share/doc/llvm-doc/html/index.html ;;
  7.     ‘erlang’)
  8.         screen -t ‘Erlang Documentation’ firefox /usr/share/doc/erlang-doc-html/html/doc/index.html ;;
  9.     ‘python’)
  10.         screen -t ‘Python Documentation’ w3m /usr/share/doc/python3-doc/html/index.html ;;
  11.     ‘php’)
  12.         screen -t ‘PHP Documentation’ w3m /usr/share/doc/php-doc/html/index.html ;;
  13.     ‘ghc’)
  14.         firefox /usr/share/doc/ghc6-doc/index.html & ;;
  15.     ‘postgresql’)
  16.         screen -t ‘PostgreSQL Documentation’ w3m /usr/share/doc/postgresql-doc-8.4/html/index.html ;;
  17.     ‘mysql’)
  18.         screen -t ‘MySQL Documentation’ w3m /usr/share/doc/mysql-doc-5.0/refman-5.0-en.html-chapter/index.html ;;
  19.     ‘apache’)
  20.         screen -t ‘Apache Documentation’ w3m /usr/share/doc/apache2-doc/manual/index.html ;;
  21.     ‘j’)
  22.         screen -t ‘J Documentation’ w3m ~/Software/j602/help/index.htm ;;
  23.     ‘lua’)
  24.         screen -t ‘Lua Documentation’ w3m /usr/share/doc/lua5.1-doc/doc/index.html ;;
  25.     ‘git’)
  26.         screen -t ‘Git Documentation’ w3m /usr/local/share/doc/git-doc/index.html ;;
  27.     ‘lighttpd’)
  28.         screen -t ‘Lighttpd Documentation’ w3m /usr/share/doc/lighttpd-doc/ ;;
  29.     ‘plt-scheme’)
  30.         screen -t ‘PLT Scheme Documentation’ w3m /usr/share/plt/doc/index.html ;;
  31.     ‘gambit’)
  32.         screen -t ‘Gambit Documentation’ w3m /usr/share/doc/gambit-doc/html/index.html ;;
  33.     ‘tintin++’)
  34.         screen -t ‘TinTin++ Documentation’ zless /usr/share/doc/tintin++/tintin19.txt.gz ;;
  35.     ‘sqlite’)
  36.         screen -t ‘SQLite Documentation’ w3m /usr/share/doc/sqlite3-doc/index.html ;;
  37.     ‘django’)
  38.         screen -t ‘Django Documentation’ w3m /usr/share/doc/python-django-doc/html/index.html ;;
  39.     ‘sbcl’)
  40.         screen -t ‘SBCL Documentation’ w3m /usr/share/doc/sbcl-doc/html/index.html ;;
  41.     ‘boost’)
  42.         screen -t ‘Boost Documentation’ w3m /usr/share/doc/libboost-doc/HTML/index.htm ;;
  43.     ‘smalltalk’)
  44.         screen -t ‘GNU Smalltalk Documentation’ info Smalltalk  ;;
  45.     ‘haskell-tutorial’)
  46.         screen -t ‘Haskell 98 Tutorial’ w3m /usr/share/doc/haskell98-tutorial/html/index.html ;;
  47.     ‘haskell-report’)
  48.         screen -t ‘Haskell 98 Report’ w3m /usr/share/doc/haskell98-report/html/index.html ;;
  49.     ‘java’)
  50.         firefox "/home/eric/Documents/Books/Programming/Java SDK/index.html" & ;;
  51.     esac
  52. }

Replace ‘w3m’ with the browser you want to use.  And make sure the paths are correct.  If you’re on a Debian-based box, that’s where those doc packages will end up.

Now whenever you’re at the terminal you can simply run stuff like

$ doc git
$ doc postgresql

to browse through the official docs.

For Git in particular you will have to build the HTML docs.  In the Git source directory:

$ make html
$ sudo make install-html

There ya go, easy way to look up docs quickly.

Related posts:

  1. MySQL Introduction
  2. PostgreSQL Introduction
  3. Powerful Data Insertion Features in MySQL
  4. Issues With MySQL
  5. Data Schema Documentation Tool : SchemaSpy
0 Comment   |   Posted in Tips & Tricks,blog by EricR on January 22, 2010