]> granicus.if.org Git - php/commitdiff
- Reapplied the "treat umask as octal in "config-set"
authorTomas V.V.Cox <cox@php.net>
Fri, 7 Jun 2002 14:50:39 +0000 (14:50 +0000)
committerTomas V.V.Cox <cox@php.net>
Fri, 7 Jun 2002 14:50:39 +0000 (14:50 +0000)
  command" Stig's patch
- Ported the config-help command to new UI API

pear/PEAR/Command/Config.php

index 296119e286e7c81f58ccb5d094eb9d04d10298d3..2639ad77f7a277f320897d161add2c4d9bc3c1dc 100644 (file)
@@ -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
      *