forked from pear2/Console_CommandLine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deal with EOLs that are on a line by them self so columnWrap doesn't …
…sallow them up. pear2/PEAR2_Console_CommandLine#2
- Loading branch information
Showing
2 changed files
with
87 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--TEST-- | ||
Test for bug #18682: columnWrap() in Default Renderer eats up lines with only a EOL. | ||
--ARGS-- | ||
cmd1 --help 2>&1 | ||
--FILE-- | ||
<?php | ||
|
||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'tests.inc.php'; | ||
|
||
class Renderer extends Console_CommandLine_Renderer_Default { | ||
protected function description() { | ||
return $this->columnWrap($this->parser->description, 2); | ||
} | ||
} | ||
|
||
$parser = new Console_CommandLine(); | ||
$parser->accept(new Renderer); | ||
$parser->renderer->line_width = 75; | ||
$parser->addCommand('cmd1', array( | ||
'description' => ' | ||
Installs listed packages. | ||
local package.xml example: | ||
php pyrus.phar install package.xml | ||
local package archive example: | ||
php pyrus.phar install PackageName-1.2.0.tar | ||
remote package archive example: | ||
php pyrus.phar install http://www.example.com/PackageName-1.2.0.tgz | ||
Examples of an abstract package: | ||
php pyrus.phar install PackageName | ||
installs PackageName from the default channel with stability preferred_state | ||
php pyrus.phar pear/PackageName | ||
installs PackageName from the pear.php.net channel with stability preferred_state | ||
php pyrus.phar install channel://doc.php.net/PackageName | ||
installs PackageName from the doc.php.net channel with stability preferred_state | ||
php pyrus.phar install PackageName-beta | ||
installs PackageName from the default channel, beta or stable stability | ||
php pyrus.phar install PackageName-1.2.0 | ||
installs PackageName from the default channel, version 1.2.0' | ||
)); | ||
$parser->parse(); | ||
|
||
?> | ||
--EXPECTF-- | ||
Installs listed packages. | ||
|
||
local package.xml example: | ||
php pyrus.phar install package.xml | ||
|
||
local package archive example: | ||
php pyrus.phar install PackageName-1.2.0.tar | ||
|
||
remote package archive example: | ||
php pyrus.phar install http://www.example.com/PackageName-1.2.0.tgz | ||
|
||
Examples of an abstract package: | ||
php pyrus.phar install PackageName | ||
installs PackageName from the default channel with stability | ||
preferred_state | ||
php pyrus.phar pear/PackageName | ||
installs PackageName from the pear.php.net channel with stability | ||
preferred_state | ||
php pyrus.phar install channel://doc.php.net/PackageName | ||
installs PackageName from the doc.php.net channel with stability | ||
preferred_state | ||
php pyrus.phar install PackageName-beta | ||
installs PackageName from the default channel, beta or stable stability | ||
php pyrus.phar install PackageName-1.2.0 | ||
installs PackageName from the default channel, version 1.2.0 | ||
|
||
Usage: | ||
/Users/helgi/projects/projects/php/pear/packages/Console_CommandLine/trunk/tests/console_commandline_bug18682.php | ||
[options] cmd1 [options] | ||
|
||
Options: | ||
-h, --help show this help message and exit |