]> granicus.if.org Git - php/commitdiff
Go with the help system
authorTomas V.V.Cox <cox@php.net>
Mon, 1 Apr 2002 14:32:40 +0000 (14:32 +0000)
committerTomas V.V.Cox <cox@php.net>
Mon, 1 Apr 2002 14:32:40 +0000 (14:32 +0000)
pear/PEAR/Command.php
pear/PEAR/Command/Common.php
pear/PEAR/Command/Install.php
pear/PEAR/Command/Package.php

index 851099e66bffb0c22795fb9ec725e3653a54765f..8cd99ef74c9ca5fd3819a541592cf09954f9dfd9 100644 (file)
@@ -205,6 +205,15 @@ class PEAR_Command
         }
         return $GLOBALS['_PEAR_Command_commandopts'];
     }
+
+    function getHelp($command)
+    {
+        $cmds = PEAR_Command::getCommands();
+        if (isset($cmds[$command])) {
+            return call_user_func(array($cmds[$command], 'getHelp'), $command);
+        }
+        return false;
+    }
 }
 
 ?>
\ No newline at end of file
index 7ea724a999e202550c1f3845979fb6762085aac4..6b9bc744d81700ed777c485c472e770576db7b1f 100644 (file)
@@ -54,6 +54,11 @@ class PEAR_Command_Common extends PEAR
         return array();
     }
 
+    function getHelp($command)
+    {
+        return array(null, 'No help avaible yet');
+    }
+
     /**
      * Return a PEAR_CommandResponse object with parameters
      * filled in.
index 7204c309bfd76a714c8d956119420fef813eb739..1960bc55c372ce28a3adb3e1ee55e7d5caa05eea 100644 (file)
@@ -57,6 +57,21 @@ class PEAR_Command_Install extends PEAR_Command_Common
         return array('install', 'uninstall', 'upgrade');
     }
 
+    function getHelp($command)
+    {
+        switch ($command) {
+            case 'install':
+                return array('<pear package>',
+                             'Installs a PEAR package created by the "package" command');
+            case 'uninstall':
+                return array('<package>',
+                             'Uninstalls a previously installed PEAR package');
+            case 'upgrade':
+                return array('<pear package>',
+                             'Upgrades a PEAR package installed in the system');
+        }
+    }
+
     // }}}
     // {{{ run()
 
index a95f45a1fd6fdceab8b4d7e5d54546c22749008a..84be4056c4329d8be7ff55719a493978ffa83d3f 100644 (file)
@@ -1,4 +1,22 @@
 <?php
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Author: Stig Bakken <ssb@fast.no>                                    |
+// +----------------------------------------------------------------------+
+//
+// $Id$
 
 require_once 'PEAR/Command/Common.php';
 require_once 'PEAR/Packager.php';
@@ -35,6 +53,24 @@ class PEAR_Command_Package extends PEAR_Command_Common
     }
 
     // }}}
+
+    function getHelp($command)
+    {
+        switch ($command) {
+            case 'package':
+                return array('[<package.xml>]',
+                             'Creates a PEAR package from its description file (usually '.
+                             'named as package.xml)');
+            case 'package-list':
+                return array('<pear package>',
+                             'List the contents of a PEAR package');
+            case 'packge-info':
+                return array('<pear package>',
+                             'Shows information about a PEAR package');
+        }
+    }
+
+
     // {{{ run()
 
     /**
@@ -217,7 +253,6 @@ class PEAR_Command_Package extends PEAR_Command_Common
 
     // }}}
 
-
 }
 
 ?>
\ No newline at end of file