cvs: php4 /pear/PEAR/Command Config.php

From: Date: Tue, 14 May 2002 12:46:17 +0000
Subject: cvs: php4 /pear/PEAR/Command Config.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-3820@lists.php.net to get a copy of this message
ssb Tue May 14 08:46:17 2002 EDT Modified files: /php4/pear/PEAR/Command Config.php Log: * convert to new command setup Index: php4/pear/PEAR/Command/Config.php diff -u php4/pear/PEAR/Command/Config.php:1.9 php4/pear/PEAR/Command/Config.php:1.10 --- php4/pear/PEAR/Command/Config.php:1.9 Wed May 8 22:31:36 2002 +++ php4/pear/PEAR/Command/Config.php Tue May 14 08:46:17 2002 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Config.php,v 1.9 2002/05/09 02:31:36 ssb Exp $ +// $Id: Config.php,v 1.10 2002/05/14 12:46:17 ssb Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Config.php"; @@ -29,10 +29,38 @@ */ class PEAR_Command_Config extends PEAR_Command_Common { - // {{{ properties - // }}} - - // {{{ constructor + var $commands = array( + 'config-show' => array( + 'summary' => 'Show All Settings', + 'options' => array(), + 'doc' => 'Displays all configuration values. An optional argument +may be used to tell which configuration layer to display. Valid +configuration layers are "user", "system" and "default". +', + ), + 'config-get' => array( + 'summary' => 'Show One Setting', + 'options' => array(), + 'doc' => 'Displays the value of one configuration parameter. The +first argument is the name of the parameter, an optional second argument +may be used to tell which configuration layer to look in. Valid configuration +layers are "user", "system" and "default". If no layer is specified, a value +will be picked from the first layer that defines the parameter, in the order +just specified. +', + ), + 'config-set' => array( + 'summary' => 'Change Setting', + 'options' => array(), + 'doc' => 'Sets the value of one configuration parameter. The first +argument is the name of the parameter, the second argument is the new value. +Some parameters are be subject to validation, and the command will fail with +an error message if the new value does not make sense. An optional third +argument may be used to specify which layer to set the configuration parameter +in. The default layer is "user". +', + ), + ); /** * PEAR_Command_Config constructor. @@ -44,46 +72,6 @@ parent::PEAR_Command_Common($ui, $config); } - // }}} - - // {{{ getCommands() - - /** - * Return a list of all the commands defined by this class. - * @return array list of commands - * @access public - */ - function getCommands() - { - return array('config-show' => 'Show All Settings', - 'config-get' => 'Show One Setting', - 'config-set' => 'Change Setting'); - } - - // }}} - - function getHelp($command) - { - switch ($command) { - case 'config-show': - $ret = array('[<layer>]', 'Displays the configuration'); - break; - case 'config-get': - $ret = array('<parameter> [<layer>]', - 'Displays the value of the given parameter'); - break; - case 'config-set': - $ret = array('<parameter> <value> [<layer>]', - 'Sets the value of a parameter in the config'); - break; - } - $ret[1] .= "\n". - " <layer> Where to store/get the configuration. The installer\n". - " supports 'user' (per user conf) and 'system' (global conf)"; - return $ret; - } - // {{{ run() - function run($command, $options, $params) { $cf = &$this->config; @@ -159,14 +147,12 @@ return true; } - // }}} - /** - * Checks if a layer is defined or not - * - * @param string $layer The layer to search for - * @return mixed False on no error or the error message - */ + * Checks if a layer is defined or not + * + * @param string $layer The layer to search for + * @return mixed False on no error or the error message + */ function _checkLayer($layer = null) { if (!empty($layer)) {

« previous php.pear.cvs (#3820) next »