Browse Source

- Reapplied the "treat umask as octal in "config-set"

command" Stig's patch
- Ported the config-help command to new UI API
experimental/new_apache_hooks
Tomas V.V.Cox 24 years ago
parent
commit
f3673c8798
  1. 33
      pear/PEAR/Command/Config.php

33
pear/PEAR/Command/Config.php

@ -67,6 +67,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.
',
),
);
/**
@ -137,6 +147,9 @@ in. The default layer is "user".
$failmsg .= $error;
return PEAR::raiseError($failmsg);
}
if ($params[0] == 'umask') {
list($params[1]) = sscanf($params[1], '%o');
}
if (!call_user_func_array(array(&$this->config, 'set'), $params))
{
$failmsg = "config-set (" . implode(", ", $params) . ") failed";
@ -149,6 +162,26 @@ in. The default layer is "user".
return true;
}
function doConfigHelp($command, $options, $params)
{
if (empty($params)) {
$params = $this->config->getKeys();
}
$data['caption'] = "Config help" . ((count($params) == 1) ? " for $params[0]" : '');
$data['headline'] = array('Name', 'Type', 'Description');
$data['border'] = 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));
}
$data['data'][] = array($name, $type, $docs);
}
$this->ui->outputData($data, $command);
}
/**
* Checks if a layer is defined or not
*

Loading…
Cancel
Save