Skip to content
Permalink
Browse files

Adding raw output to xml help generation.

  • Loading branch information...
markstory committed Oct 23, 2010
1 parent 0be2208 commit a5dd06b54cf4d0a1d792bf7da63de225c0cc8cbd
Showing with 18 additions and 8 deletions.
  1. +17 −7 cake/console/shells/shell.php
  2. +1 −1 cake/tests/cases/console/libs/shell.test.php
@@ -339,13 +339,7 @@ public function runCommand($command, $argv) {
$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 @@ public function runCommand($command, $argv) {
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 @@ function testRunCommandTriggeringHelp() {
->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');

0 comments on commit a5dd06b

Please sign in to comment.
You can’t perform that action at this time.