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

From: Date: Mon, 27 May 2002 00:21:37 +0000
Subject: cvs: php4 /pear/PEAR/Command Config.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4121@lists.php.net to get a copy of this message
ssb Sun May 26 20:21:37 2002 EDT Modified files: /php4/pear/PEAR/Command Config.php Log: * added config-help command Index: php4/pear/PEAR/Command/Config.php diff -u php4/pear/PEAR/Command/Config.php:1.13 php4/pear/PEAR/Command/Config.php:1.14 --- php4/pear/PEAR/Command/Config.php:1.13 Sun May 26 15:08:21 2002 +++ php4/pear/PEAR/Command/Config.php Sun May 26 20:21:36 2002 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Config.php,v 1.13 2002/05/26 19:08:21 cox Exp $ +// $Id: Config.php,v 1.14 2002/05/27 00:21:36 ssb Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Config.php"; @@ -46,7 +46,8 @@ 'function' => 'doConfigGet', 'shortcut' => 'cg', 'options' => array(), - 'doc' => 'Displays the value of one configuration parameter. The + 'doc' => '<parameter> [layer] +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 @@ -59,7 +60,8 @@ 'function' => 'doConfigSet', 'shortcut' => 'cs', 'options' => array(), - 'doc' => 'Sets the value of one configuration parameter. The first + 'doc' => '<parameter> <new-value> [layer] +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 @@ -67,6 +69,16 @@ in. The default layer is "user". ', ), + 'config-help' => array( + 'summary' => 'Show Information About Setting', + 'function' => 'doConfigHelp', + 'shortcut' => 'ch', + 'options' => array(), + 'doc' => '[parameter] +Displays help for a configuration parameter. Without arguments it +displays help for all configuration parameters. +', + ), ); /** @@ -153,6 +165,27 @@ return $this->raiseError($failmsg); } return true; + } + + function doConfigHelp($command, $options, $params) + { + if (empty($params)) { + $params = $this->config->getKeys(); + } + $this->ui->startTable(); + $this->ui->tableRow(array('Name', 'Type', 'Description'), + array('bold' => true)); + foreach ($params as $name) { + $type = $this->config->getType($name); + $docs = $this->config->getDocs($name); + if ($type == 'set') { + $docs = rtrim($docs) . "\nValid set: " . + implode(' ', $this->config->getSetValues($name)); + } + $this->ui->tableRow(array($name, $type, $docs), null, + array(2 => array('wrap' => 50))); + } + $this->ui->endTable(); } /**

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