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

[Console][FrameworkBundle] Revised console header formatting #19275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
revised console header formatting
  • Loading branch information
ro0NL committed Jul 29, 2016
commit b4bcc08f092f66dd99f6b32520fd35ee84d270b3
14 changes: 13 additions & 1 deletion 14 src/Symfony/Bundle/FrameworkBundle/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.'));
Expand Down Expand Up @@ -100,6 +100,18 @@ public function all($namespace = null)
return parent::all($namespace);
}

/**
* {@inheritdoc}
*/
public function getLongVersion()
{
return parent::getLongVersion()
.sprintf(
' (kernel: <comment>%s</comment>, env: <comment>%s</comment>, debug: <comment>%s</comment>)',
$this->kernel->getName(), $this->kernel->getEnvironment(), $this->kernel->isDebug() ? 'true' : 'false'
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be on one line.

Copy link
Contributor Author

@ro0NL ro0NL Jul 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can i go with <comment>%s</> (vs. <comment>%s</comment>) btw? Would improve readability in a way :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC we already do that in other places.

}

protected function registerCommands()
{
if ($this->commandsRegistered) {
Expand Down
6 changes: 3 additions & 3 deletions 6 src/Symfony/Component/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,13 @@ public function getLongVersion()
{
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';
}

/**
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.