mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Adding raw output to xml help generation.
This commit is contained in:
parent
0be2208429
commit
a5dd06b54c
2 changed files with 18 additions and 8 deletions
|
@ -339,13 +339,7 @@ class Shell extends Object {
|
|||
$this->command = $command;
|
||||
|
||||
if (!empty($this->params['help'])) {
|
||||
$format = 'text';
|
||||
if (!empty($this->args[0]) && $this->args[0] == 'xml') {
|
||||
$format = 'xml';
|
||||
} else {
|
||||
$this->_welcome();
|
||||
}
|
||||
return $this->out($this->OptionParser->help($command, $format));
|
||||
return $this->_displayHelp();
|
||||
}
|
||||
|
||||
if (($isTask || $isMethod || $isMain) && $command !== 'execute' ) {
|
||||
|
@ -365,6 +359,22 @@ class Shell extends Object {
|
|||
return $this->out($this->OptionParser->help($command));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the help in the correct format
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _displayHelp() {
|
||||
$format = 'text';
|
||||
if (!empty($this->args[0]) && $this->args[0] == 'xml') {
|
||||
$format = 'xml';
|
||||
$this->output->outputAs(ConsoleOutput::RAW);
|
||||
} else {
|
||||
$this->_welcome();
|
||||
}
|
||||
return $this->out($this->OptionParser->help($command, $format));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the option parser instance and configures it.
|
||||
* By overriding this method you can configure the ConsoleOptionParser before returning it.
|
||||
|
|
|
@ -708,7 +708,7 @@ class ShellTest extends CakeTestCase {
|
|||
->will($this->returnValue(array(array('help' => true), array())));
|
||||
$Parser->expects($this->once())->method('help');
|
||||
|
||||
$Shell = $this->getMock('Shell', array('getOptionParser', 'out', 'startup'), array(), '', false);
|
||||
$Shell = $this->getMock('Shell', array('getOptionParser', 'out', 'startup', '_welcome'), array(), '', false);
|
||||
$Shell->expects($this->once())->method('getOptionParser')
|
||||
->will($this->returnValue($Parser));
|
||||
$Shell->expects($this->once())->method('out');
|
||||
|
|
Loading…
Reference in a new issue