summaryrefslogtreecommitdiff
path: root/pear/PEAR/Command/Config.php
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2002-05-27 00:21:36 +0000
committerStig Bakken <ssb@php.net>2002-05-27 00:21:36 +0000
commitcb097ffded35fa54358b151e804a6a6519692587 (patch)
treef5f185043334a1a1c477336089603957dc757ec8 /pear/PEAR/Command/Config.php
parent17e6e108acb93a66dc964496ec0b016f778cff57 (diff)
downloadphp-git-cb097ffded35fa54358b151e804a6a6519692587.tar.gz
* added config-help command
Diffstat (limited to 'pear/PEAR/Command/Config.php')
-rw-r--r--pear/PEAR/Command/Config.php37
1 files changed, 35 insertions, 2 deletions
diff --git a/pear/PEAR/Command/Config.php b/pear/PEAR/Command/Config.php
index e4441bb970..47fe111e91 100644
--- a/pear/PEAR/Command/Config.php
+++ b/pear/PEAR/Command/Config.php
@@ -46,7 +46,8 @@ configuration layers are "user", "system" and "default".
'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 @@ just specified.
'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 @@ argument may be used to specify which layer to set the configuration parameter
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.
+',
+ ),
);
/**
@@ -155,6 +167,27 @@ in. The default layer is "user".
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();
+ }
+
/**
* Checks if a layer is defined or not
*