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

From: Date: Fri, 07 Jun 2002 14:50:41 +0000
Subject: cvs: php4 /pear/PEAR/Command Config.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4482@lists.php.net to get a copy of this message
cox Fri Jun 7 10:50:41 2002 EDT Modified files: /php4/pear/PEAR/Command Config.php Log: - Reapplied the "treat umask as octal in "config-set" command" Stig's patch - Ported the config-help command to new UI API Index: php4/pear/PEAR/Command/Config.php diff -u php4/pear/PEAR/Command/Config.php:1.16 php4/pear/PEAR/Command/Config.php:1.17 --- php4/pear/PEAR/Command/Config.php:1.16 Sun Jun 2 09:07:18 2002 +++ php4/pear/PEAR/Command/Config.php Fri Jun 7 10:50:39 2002 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Config.php,v 1.16 2002/06/02 13:07:18 ssb Exp $ +// $Id: Config.php,v 1.17 2002/06/07 14:50:39 cox Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Config.php"; @@ -67,6 +67,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. +', + ), ); /** @@ -137,6 +147,9 @@ $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"; @@ -147,6 +160,26 @@ return $this->raiseError($failmsg); } 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); } /**

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