diff --git a/src/Symfony/Components/Console/Command/Command.php b/src/Symfony/Components/Console/Command/Command.php index 17e7b0a9e0..adca4d895c 100644 --- a/src/Symfony/Components/Console/Command/Command.php +++ b/src/Symfony/Components/Console/Command/Command.php @@ -381,6 +381,28 @@ class Command return $this->help; } + /** + * Returns the processed help for the command replacing the %command.name% and + * %command.full_name% patterns with the real values dynamically. + * + * @return string The processed help for the command + */ + public function getProcessedHelp() + { + $name = $this->namespace.':'.$this->name; + + $placeholders = array( + '%command.name%', + '%command.full_name%' + ); + $replacements = array( + $name, + $_SERVER['PHP_SELF'].' '.$name + ); + + return str_replace($placeholders, $replacements, $this->getHelp()); + } + /** * Sets the aliases for the command. * @@ -463,7 +485,7 @@ class Command $messages[] = $this->definition->asText(); - if ($help = $this->getHelp()) + if ($help = $this->getProcessedHelp()) { $messages[] = 'Help:'; $messages[] = ' '.implode("\n ", explode("\n", $help))."\n";