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
This commit is contained in:
commit
ad85c79d3d
@ -39,10 +39,10 @@ class Application extends BaseApplication
|
||||
{
|
||||
$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 @@ class Application extends BaseApplication
|
||||
return parent::all($namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLongVersion()
|
||||
{
|
||||
return parent::getLongVersion().sprintf(' (kernel: <comment>%s</>, env: <comment>%s</>, debug: <comment>%s</>)', $this->kernel->getName(), $this->kernel->getEnvironment(), $this->kernel->isDebug() ? 'true' : 'false');
|
||||
}
|
||||
|
||||
protected function registerCommands()
|
||||
{
|
||||
if ($this->commandsRegistered) {
|
||||
|
@ -336,13 +336,13 @@ class Application
|
||||
{
|
||||
if ('UNKNOWN' !== $this->getName()) {
|
||||
if ('UNKNOWN' !== $this->getVersion()) {
|
||||
return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
|
||||
return sprintf('%s <info>%s</info>', $this->getName(), $this->getVersion());
|
||||
}
|
||||
|
||||
return sprintf('<info>%s</info>', $this->getName());
|
||||
return $this->getName();
|
||||
}
|
||||
|
||||
return '<info>Console Tool</info>';
|
||||
return 'Console Tool';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +91,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
||||
public function testGetLongVersion()
|
||||
{
|
||||
$application = new Application('foo', 'bar');
|
||||
$this->assertEquals('<info>foo</info> version <comment>bar</comment>', $application->getLongVersion(), '->getLongVersion() returns the long version of the application');
|
||||
$this->assertEquals('foo <info>bar</info>', $application->getLongVersion(), '->getLongVersion() returns the long version of the application');
|
||||
}
|
||||
|
||||
public function testHelp()
|
||||
|
@ -1,4 +1,4 @@
|
||||
<info>Console Tool</info>
|
||||
Console Tool
|
||||
|
||||
<comment>Usage:</comment>
|
||||
command [options] [arguments]
|
||||
|
@ -1,4 +1,4 @@
|
||||
<info>My Symfony application</info> version <comment>v1.0</comment>
|
||||
My Symfony application <info>v1.0</info>
|
||||
|
||||
<comment>Usage:</comment>
|
||||
command [options] [arguments]
|
||||
|
@ -1 +1 @@
|
||||
<info>Console Tool</info>
|
||||
Console Tool
|
Reference in New Issue
Block a user