#014803: Problem with ezcConsoleOption when short option name is empty

Description:

Hi

I want to have two options which are mutual exclusive. This works fine:


$inputOption = $input->registerOption(
    new ezcConsoleOption(
        'i',
        'input',
        ezcConsoleInput::TYPE_STRING
    )
);

$outputOption = $input->registerOption(
    new ezcConsoleOption(
        'o',
        'output'
    )
);
$outputOption->type = ezcConsoleInput::TYPE_STRING;

$inputOption->addExclusion( new ezcConsoleOptionRule( $outputOption ) );
$outputOption->addExclusion( new ezcConsoleOptionRule( $inputOption ) );

But this doesn't work if you don't want to have short parameters like -i and -o (only --input and --output). There is nothing in the documentation saying this is not possible. On the contrary, http://ezcomponents.org/docs/api/trunk/ConsoleTools/ezcConsoleOption.htmlurl


ezcConsoleOption __construct( [string $short = ''], string $long (...) )

However, if you let $short='', the example above will not work:


$inputOption = $input->registerOption(
    new ezcConsoleOption(
        '',
        'input',
        ezcConsoleInput::TYPE_STRING
    )
);

$outputOption = $input->registerOption(
    new ezcConsoleOption(
        '',
        'output'
    )
);
$outputOption->type = ezcConsoleInput::TYPE_STRING;

$inputOption->addExclusion( new ezcConsoleOptionRule( $outputOption ) );
$outputOption->addExclusion( new ezcConsoleOptionRule( $inputOption ) );

The output will then be:


$ php a.php -input asd
The option 'input' excludes the option 'output'but this one was submitted.

(also note the lack of space before "but")

PS
My example is based on example 6 on http://ezcomponents.org/docs/tutorials/ConsoleTools#mastering-options-and-argumentsurl


Environment:

Operating System:
PHP Version: (please be specific, like '4.4.3' or '5.1.5')
Database and version:
Browser (and version):


- Attachments

No attachments for this issue.


- Comments

Fixed in rev. #10232.

#261509 by Tobias Schlitt on May 8th, 2009 [Permanent Link]

- History
Properties
Type Bug
Priority Medium
Component Components » ConsoleTools
Affects 1.5 - ConsoleTools 1.5
Fix Versions 2008.2.3 - eZ components 2008.2.3
2009.1alpha1 - eZ components 2009.1alpha1
Reporter Vidar Langseid
Responsible Tobias Schlitt
Status 0 Closed
Resolution Fixed
Created April 23rd, 2009
Updated May 8th, 2009
Resolved May 8th, 2009
 
Navigation [Permanent Link]
Previous Issue
Back to Issues List
Next Issue: #015537
  Graph shows to small and truncated rotated axis labels