svn: /pear2/Pyrus/trunk/ data/built-in-commands.xml src/Pyrus/PluginRegistry.php src/Pyrus/ScriptFrontend/Commands.php
| From: | Brett Bieber | Date: | Thu, 03 Dec 2009 16:30:11 +0000 |
| Subject: | svn: /pear2/Pyrus/trunk/ data/built-in-commands.xml src/Pyrus/PluginRegistry.php src/Pyrus/ScriptFrontend/Commands.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-9066@lists.php.net to get a copy of this message | ||
saltybeagle Thu, 03 Dec 2009 16:30:11 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=291661
Log:
Provide easy way to manage plugin configuration using pyrus set -p bin_dir /blah, pyrus config-show
-p
Changed paths:
U pear2/Pyrus/trunk/data/built-in-commands.xml
U pear2/Pyrus/trunk/src/Pyrus/PluginRegistry.php
U pear2/Pyrus/trunk/src/Pyrus/ScriptFrontend/Commands.php
Modified: pear2/Pyrus/trunk/data/built-in-commands.xml
===================================================================
--- pear2/Pyrus/trunk/data/built-in-commands.xml 2009-12-03 16:02:15 UTC (rev 291660)
+++ pear2/Pyrus/trunk/data/built-in-commands.xml 2009-12-03 16:30:11 UTC (rev 291661)
@@ -431,7 +431,14 @@
<function>configShow</function>
<summary>Show all configuration values</summary>
<shortcut>cs</shortcut>
- <options/>
+ <options>
+ <option>
+ <name>plugin</name>
+ <shortopt>p</shortopt>
+ <type><bool/></type>
+ <doc>List plugin configuration only</doc>
+ </option>
+ </options>
<arguments/>
<doc>List all configuration values.
@@ -444,7 +451,14 @@
<function>set</function>
<summary>Set a configuration value</summary>
<shortcut>set</shortcut>
- <options/>
+ <options>
+ <option>
+ <name>plugin</name>
+ <shortopt>p</shortopt>
+ <type><bool/></type>
+ <doc>Manage plugin configuration only</doc>
+ </option>
+ </options>
<arguments>
<argument>
<name>variable</name>
Modified: pear2/Pyrus/trunk/src/Pyrus/PluginRegistry.php
===================================================================
--- pear2/Pyrus/trunk/src/Pyrus/PluginRegistry.php 2009-12-03 16:02:15 UTC (rev 291660)
+++ pear2/Pyrus/trunk/src/Pyrus/PluginRegistry.php 2009-12-03 16:30:11 UTC (rev 291661)
@@ -44,7 +44,6 @@
}
$current = \pear2\Pyrus\Config::current();
self::$config = \pear2\Pyrus\Config::singleton($this->pluginRegistryPath);
- self::$config->bin_dir = $current->bin_dir;
\pear2\Pyrus\Config::setCurrent($current->path);
parent::__construct($this->pluginRegistryPath, array('Sqlite3',
'Xml'));
}
Modified: pear2/Pyrus/trunk/src/Pyrus/ScriptFrontend/Commands.php
===================================================================
--- pear2/Pyrus/trunk/src/Pyrus/ScriptFrontend/Commands.php 2009-12-03 16:02:15 UTC (rev 291660)
+++ pear2/Pyrus/trunk/src/Pyrus/ScriptFrontend/Commands.php 2009-12-03 16:30:11 UTC (rev 291661)
@@ -729,9 +729,13 @@
* Display pyrus configuration vars
*
*/
- function configShow()
+ function configShow($args, $options)
{
- $conf = \pear2\Pyrus\Config::current();
+ $conf = $current = \pear2\Pyrus\Config::current();
+ if ($options['plugin']) {
+ echo "Plugin configuration:\n";
+ $conf = \pear2\Pyrus\Config::singleton(\pear2\Pyrus\Config::current()->plugins_dir);
+ }
echo "System paths:\n";
foreach ($conf->mainsystemvars as $var) {
echo " $var => " . $conf->$var . "\n";
@@ -763,9 +767,12 @@
*
* @param array $args
*/
- function set($args)
+ function set($args, $options)
{
- $conf = \pear2\Pyrus\Config::current();
+ $conf = $current = \pear2\Pyrus\Config::current();
+ if ($options['plugin']) {
+ $conf = \pear2\Pyrus\Config::singleton(\pear2\Pyrus\Config::current()->plugins_dir);
+ }
if (in_array($args['variable'], $conf->uservars)) {
echo "Setting $args[variable] in " . $conf->userfile . "\n";
$conf->{$args['variable']} = $args['value'];
@@ -777,6 +784,9 @@
exit -1;
}
$conf->saveConfig();
+ if ($options['plugin']) {
+ \pear2\Pyrus\Config::setCurrent($current->path);
+ }
}
/**