mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Making xml help work.
Need to update tests.
This commit is contained in:
parent
65686a0648
commit
a6a627bd92
2 changed files with 17 additions and 5 deletions
|
@ -470,7 +470,7 @@ class ConsoleOptionParser {
|
|||
* @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 @@ class ConsoleOptionParser {
|
|||
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 @@ class Shell extends Object {
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue