diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index 2e7a8da68f787..5dfe21357f46a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -39,10 +39,10 @@ public function __construct(KernelInterface $kernel) { $this->kernel = $kernel; - parent::__construct('Symfony', Kernel::VERSION.' - '.$kernel->getName().'/'.$kernel->getEnvironment().($kernel->isDebug() ? '/debug' : '')); + parent::__construct('Symfony', Kernel::VERSION); - $this->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $kernel->getEnvironment())); - $this->getDefinition()->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.')); + $this->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The environment name', $kernel->getEnvironment())); + $this->getDefinition()->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode')); } /** @@ -100,6 +100,14 @@ public function all($namespace = null) return parent::all($namespace); } + /** + * {@inheritdoc} + */ + public function getLongVersion() + { + return parent::getLongVersion().sprintf(' (kernel: %s, env: %s, debug: %s)', $this->kernel->getName(), $this->kernel->getEnvironment(), $this->kernel->isDebug() ? 'true' : 'false'); + } + protected function registerCommands() { if ($this->commandsRegistered) { diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index af01e9e8a6fbe..f0129d5a9a9bc 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -336,13 +336,13 @@ public function getLongVersion() { if ('UNKNOWN' !== $this->getName()) { if ('UNKNOWN' !== $this->getVersion()) { - return sprintf('%s version %s', $this->getName(), $this->getVersion()); + return sprintf('%s %s', $this->getName(), $this->getVersion()); } - return sprintf('%s', $this->getName()); + return $this->getName(); } - return 'Console Tool'; + return 'Console Tool'; } /** diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 94eefb0a4dbfd..3ef33f37944ba 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -91,7 +91,7 @@ public function testSetGetVersion() public function testGetLongVersion() { $application = new Application('foo', 'bar'); - $this->assertEquals('foo version bar', $application->getLongVersion(), '->getLongVersion() returns the long version of the application'); + $this->assertEquals('foo bar', $application->getLongVersion(), '->getLongVersion() returns the long version of the application'); } public function testHelp() diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_1.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_1.txt index c4cf8f2164cf4..8a7b47e0c4b00 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_1.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_1.txt @@ -1,4 +1,4 @@ -Console Tool +Console Tool Usage: command [options] [arguments] diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_2.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_2.txt index 268a0c06461cb..b28036599642d 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_2.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_2.txt @@ -1,4 +1,4 @@ -My Symfony application version v1.0 +My Symfony application v1.0 Usage: command [options] [arguments] diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_gethelp.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_gethelp.txt index 0c16e3c84be45..5a5920d0eb759 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_gethelp.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_gethelp.txt @@ -1 +1 @@ -Console Tool \ No newline at end of file +Console Tool \ No newline at end of file