Author: Tobias Schlitt
Date: 2007-05-05 21:54:20 +0200 (Sat, 05 May 2007)
New Revision: 5067
Log:
- Implemented issue #9216: ezcConsoleInput::getOptionValues I want long names.
Modified:
trunk/ConsoleTools/ChangeLog
trunk/ConsoleTools/src/input.php
trunk/ConsoleTools/tests/input_test.php
Modified: trunk/ConsoleTools/ChangeLog
===================================================================
--- trunk/ConsoleTools/ChangeLog 2007-05-05 19:47:16 UTC (rev 5066)
+++ trunk/ConsoleTools/ChangeLog 2007-05-05 19:54:20 UTC (rev 5067)
@@ -23,6 +23,7 @@
status.
- Implemented issue #8461: Argument help text. A completely new argument
handling was invented.
+- Implemented issue #9216: ezcConsoleInput::getOptionValues I want long names.
1.2 - Monday 18 December 2006
Modified: trunk/ConsoleTools/src/input.php
===================================================================
--- trunk/ConsoleTools/src/input.php 2007-05-05 19:47:16 UTC (rev 5066)
+++ trunk/ConsoleTools/src/input.php 2007-05-05 19:54:20 UTC (rev 5067)
@@ -558,16 +558,17 @@
* does not contain any parameter, which value is 'false' (meaning: the
* parameter was not submitted).
*
+ * @param bool $longnames Wheather to use longnames for indexing.
* @return array(string=>mixed)
*/
- public function getOptionValues()
+ public function getOptionValues( $longnames = false )
{
$res = array();
foreach ( $this->options as $param )
{
if ( $param->value !== false )
{
- $res[$param->short] = $param->value;
+ $res[( $longnames === true ) ? $param->long : $param->short] =
$param->value;
}
}
return $res;
Modified: trunk/ConsoleTools/tests/input_test.php
===================================================================
--- trunk/ConsoleTools/tests/input_test.php 2007-05-05 19:47:16 UTC (rev
5066)
+++ trunk/ConsoleTools/tests/input_test.php 2007-05-05 19:54:20 UTC (rev
5067)
@@ -617,6 +617,21 @@
"Processing from \$_SERVER['argv'] did not work."
);
}
+
+ public function testProcessSuccessGetOptionValuesLongnames()
+ {
+ $_SERVER["argv"] = array(
+ 'foo.php',
+ '--build',
+ '42'
+ );
+ $this->input->process();
+ $this->assertEquals(
+ array( "build" => 42, "destroy" => "world" ),
+ $this->input->getOptionValues( true ),
+ "Processing from \$_SERVER['argv'] did not work."
+ );
+ }
public function testProcessSuccessSingleShortNoValueArguments()
{
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components