From f3673c8798c2a063e436eabe49fd21071e91a8a1 Mon Sep 17 00:00:00 2001 From: "Tomas V.V.Cox" Date: Fri, 7 Jun 2002 14:50:39 +0000 Subject: [PATCH] - Reapplied the "treat umask as octal in "config-set" command" Stig's patch - Ported the config-help command to new UI API --- pear/PEAR/Command/Config.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/pear/PEAR/Command/Config.php b/pear/PEAR/Command/Config.php index 296119e286..2639ad77f7 100644 --- a/pear/PEAR/Command/Config.php +++ b/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 * -- 2.40.0