From b4bcc08f092f66dd99f6b32520fd35ee84d270b3 Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Fri, 1 Jul 2016 08:05:06 +0000 Subject: [PATCH 1/5] revised console header formatting --- .../Bundle/FrameworkBundle/Console/Application.php | 14 +++++++++++++- src/Symfony/Component/Console/Application.php | 6 +++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index 2e7a8da68f787..255942a910472 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -39,7 +39,7 @@ 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.')); @@ -100,6 +100,18 @@ 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'; } /** From 76992f633b9f569af3136bcf60dc89c73184d226 Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Sun, 3 Jul 2016 13:36:38 +0000 Subject: [PATCH 2/5] remove kernel info from 'long version' + consistent input options --- .../Bundle/FrameworkBundle/Console/Application.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index 255942a910472..22dc6a8e0ef15 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -41,8 +41,8 @@ public function __construct(KernelInterface $kernel) 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')); } /** @@ -107,8 +107,8 @@ public function getLongVersion() { return parent::getLongVersion() .sprintf( - ' (kernel: %s, env: %s, debug: %s)', - $this->kernel->getName(), $this->kernel->getEnvironment(), $this->kernel->isDebug() ? 'true' : 'false' + ' (env: %s, debug: %s)', + $this->kernel->getEnvironment(), $this->kernel->isDebug() ? 'true' : 'false' ); } From fde325973477de9eddee3463ae718af6ba9a68fc Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Mon, 4 Jul 2016 11:44:29 +0000 Subject: [PATCH 3/5] cs --- src/Symfony/Bundle/FrameworkBundle/Console/Application.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index 22dc6a8e0ef15..b37aee9d37b46 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -105,11 +105,7 @@ public function all($namespace = null) */ public function getLongVersion() { - return parent::getLongVersion() - .sprintf( - ' (env: %s, debug: %s)', - $this->kernel->getEnvironment(), $this->kernel->isDebug() ? 'true' : 'false' - ); + return parent::getLongVersion().sprintf(' (env: %s, debug: %s)', $this->kernel->getEnvironment(), $this->kernel->isDebug() ? 'true' : 'false'); } protected function registerCommands() From d307ca2bda7ee33cfd6e1017f9802d6c99c3ba2f Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Wed, 20 Jul 2016 10:36:58 +0000 Subject: [PATCH 4/5] readded kernel name --- src/Symfony/Bundle/FrameworkBundle/Console/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index b37aee9d37b46..5dfe21357f46a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -105,7 +105,7 @@ public function all($namespace = null) */ public function getLongVersion() { - return parent::getLongVersion().sprintf(' (env: %s, debug: %s)', $this->kernel->getEnvironment(), $this->kernel->isDebug() ? 'true' : 'false'); + return parent::getLongVersion().sprintf(' (kernel: %s, env: %s, debug: %s)', $this->kernel->getName(), $this->kernel->getEnvironment(), $this->kernel->isDebug() ? 'true' : 'false'); } protected function registerCommands() From 3621e0f229d9a16cc668fafdcfa34a94f9f46924 Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Fri, 29 Jul 2016 09:37:52 +0000 Subject: [PATCH 5/5] fixed tests --- src/Symfony/Component/Console/Tests/ApplicationTest.php | 2 +- src/Symfony/Component/Console/Tests/Fixtures/application_1.txt | 2 +- src/Symfony/Component/Console/Tests/Fixtures/application_2.txt | 2 +- .../Component/Console/Tests/Fixtures/application_gethelp.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) 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