Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ad85c79

Browse filesBrowse files
committed
minor #19275 [Console][FrameworkBundle] Revised console header formatting (ro0NL)
This PR was squashed before being merged into the 3.2-dev branch (closes #19275). Discussion ---------- [Console][FrameworkBundle] Revised console header formatting | Q | A | ------------- | --- | Branch? | "master" | Bug fix? | no | New feature? | yes (ui change) | BC breaks? | no | Deprecations? | no | Tests pass? | not yet | Fixed tickets | #19095 | License | MIT | Doc PR | reference to the documentation PR, if any Before/After ![image](https://cloud.githubusercontent.com/assets/1047696/16983804/e36c95e0-4e76-11e6-854d-dfa22c634b39.png) Commits ------- fcddb3a [Console][FrameworkBundle] Revised console header formatting
2 parents ec3a4ed + fcddb3a commit ad85c79
Copy full SHA for ad85c79

File tree

6 files changed

+18
-10
lines changed
Filter options

6 files changed

+18
-10
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Console/Application.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Console/Application.php
+11-3Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ public function __construct(KernelInterface $kernel)
3939
{
4040
$this->kernel = $kernel;
4141

42-
parent::__construct('Symfony', Kernel::VERSION.' - '.$kernel->getName().'/'.$kernel->getEnvironment().($kernel->isDebug() ? '/debug' : ''));
42+
parent::__construct('Symfony', Kernel::VERSION);
4343

44-
$this->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $kernel->getEnvironment()));
45-
$this->getDefinition()->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.'));
44+
$this->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The environment name', $kernel->getEnvironment()));
45+
$this->getDefinition()->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode'));
4646
}
4747

4848
/**
@@ -100,6 +100,14 @@ public function all($namespace = null)
100100
return parent::all($namespace);
101101
}
102102

103+
/**
104+
* {@inheritdoc}
105+
*/
106+
public function getLongVersion()
107+
{
108+
return parent::getLongVersion().sprintf(' (kernel: <comment>%s</>, env: <comment>%s</>, debug: <comment>%s</>)', $this->kernel->getName(), $this->kernel->getEnvironment(), $this->kernel->isDebug() ? 'true' : 'false');
109+
}
110+
103111
protected function registerCommands()
104112
{
105113
if ($this->commandsRegistered) {

‎src/Symfony/Component/Console/Application.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Application.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,13 @@ public function getLongVersion()
336336
{
337337
if ('UNKNOWN' !== $this->getName()) {
338338
if ('UNKNOWN' !== $this->getVersion()) {
339-
return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
339+
return sprintf('%s <info>%s</info>', $this->getName(), $this->getVersion());
340340
}
341341

342-
return sprintf('<info>%s</info>', $this->getName());
342+
return $this->getName();
343343
}
344344

345-
return '<info>Console Tool</info>';
345+
return 'Console Tool';
346346
}
347347

348348
/**

‎src/Symfony/Component/Console/Tests/ApplicationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/ApplicationTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function testSetGetVersion()
9191
public function testGetLongVersion()
9292
{
9393
$application = new Application('foo', 'bar');
94-
$this->assertEquals('<info>foo</info> version <comment>bar</comment>', $application->getLongVersion(), '->getLongVersion() returns the long version of the application');
94+
$this->assertEquals('foo <info>bar</info>', $application->getLongVersion(), '->getLongVersion() returns the long version of the application');
9595
}
9696

9797
public function testHelp()

‎src/Symfony/Component/Console/Tests/Fixtures/application_1.txt

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Fixtures/application_1.txt
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<info>Console Tool</info>
1+
Console Tool
22

33
<comment>Usage:</comment>
44
command [options] [arguments]

‎src/Symfony/Component/Console/Tests/Fixtures/application_2.txt

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Fixtures/application_2.txt
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<info>My Symfony application</info> version <comment>v1.0</comment>
1+
My Symfony application <info>v1.0</info>
22

33
<comment>Usage:</comment>
44
command [options] [arguments]
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<info>Console Tool</info>
1+
Console Tool

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.