[Console] MarkdownDescriptor: Don't use getLongVersion

This commit is contained in:
Maxime STEINHAUSSER 2016-12-13 16:08:14 +01:00 committed by Maxime Steinhausser
parent fc2395e237
commit 6896865bcc
2 changed files with 17 additions and 3 deletions

View File

@ -123,8 +123,9 @@ class MarkdownDescriptor extends Descriptor
{
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
$description = new ApplicationDescription($application, $describedNamespace);
$title = $this->getApplicationTitle($application);
$this->write($application->getLongVersion()."\n".str_repeat('=', Helper::strlen($application->getLongVersion())));
$this->write($title."\n".str_repeat('=', Helper::strlen($title)));
foreach ($description->getNamespaces() as $namespace) {
if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
@ -143,4 +144,17 @@ class MarkdownDescriptor extends Descriptor
$this->write($this->describeCommand($command));
}
}
private function getApplicationTitle(Application $application)
{
if ('UNKNOWN' !== $application->getName()) {
if ('UNKNOWN' !== $application->getVersion()) {
return sprintf('%s %s', $application->getName(), $application->getVersion());
}
return $application->getName();
}
return 'Console Tool';
}
}

View File

@ -1,5 +1,5 @@
My Symfony application <info>v1.0</info>
========================================
My Symfony application v1.0
===========================
* [`alias1`](#descriptorcommand1)
* [`alias2`](#descriptorcommand1)