Skip to content
Permalink
Browse files

Making xml help work.

Need to update tests.
  • Loading branch information...
markstory committed Oct 20, 2010
1 parent 65686a0 commit a6a627bd92f6156afc09d15de439275800cdfc9b
Showing with 17 additions and 5 deletions.
  1. +6 −2 cake/console/libs/console_option_parser.php
  2. +11 −3 cake/console/shells/shell.php
@@ -470,7 +470,7 @@ public function parse($argv, $command = null) {
* @param int $width The width to format user content to. Defaults to 72
* @return string Generated help.
*/
public function help($subcommand = null, $width = 72) {
public function help($subcommand = null, $format = 'text', $width = 72) {
if (
isset($this->_subcommands[$subcommand]) &&
$this->_subcommands[$subcommand]->parser() instanceof self
@@ -480,7 +480,11 @@ public function help($subcommand = null, $width = 72) {
return $subparser->help();
}
$formatter = new HelpFormatter($this);
return $formatter->text($width);
if ($format == 'text' || $format === true) {
return $formatter->text($width);
} elseif ($format == 'xml') {
return $formatter->xml();
}
}
/**
@@ -338,12 +338,20 @@ public function runCommand($command, $argv) {
list($this->params, $this->args) = $this->OptionParser->parse($argv, $command);
$this->command = $command;
if (!empty($this->params['help'])) {
$isXml = false;
$format = 'text';
if (!empty($this->args[0]) && $this->args[0] == 'xml') {
$format = 'xml';
} else {
$this->_welcome();
}
return $this->out($this->OptionParser->help($command, $format));
}
if (($isTask || $isMethod || $isMain) && $command !== 'execute' ) {
$this->startup();
}
if (!empty($this->params['help'])) {
return $this->out($this->OptionParser->help($command));
}
if ($isTask) {
$command = Inflector::camelize($command);

0 comments on commit a6a627b

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