Skip to content

Commit

Permalink
Print launcher version, addresses #3164 (#3295)
Browse files Browse the repository at this point in the history
  • Loading branch information
nvaken authored and jmolivas committed May 5, 2017
1 parent fb23cb5 commit ee8fb83
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
5 changes: 4 additions & 1 deletion bin/drupal.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
exit(1);
}

$application = new Application($container);
if (!isset($launcherVersion))
$launcherVersion = FALSE;

$application = new Application($container, $launcherVersion);
$application->setDefaultCommand('about');
$application->run();
45 changes: 44 additions & 1 deletion src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,54 @@ class Application extends BaseApplication
*/
const VERSION = '1.0.0-rc18';

public function __construct(ContainerInterface $container)
/**
* @var string
*/
private $launcherVersion;

public function __construct(ContainerInterface $container, $launcherVersion = FALSE)
{
$this->setLauncherVersion($launcherVersion);
parent::__construct($container, $this::NAME, $this::VERSION);
}

/**
* Returns the long version of the application.
*
* @return string The long application version
*/
public function getLongVersion()
{
$output = '';

if ($this->launcherVersion) {
$output .= sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName() . ' Launcher', $this->getLauncherVersion());
$output .= PHP_EOL;
}

if ('UNKNOWN' !== $this->getName()) {
if ('UNKNOWN' !== $this->getVersion()) {
$output .= sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
}
else {
$output .= sprintf('<info>%s</info>', $this->getName());
}
}
else {
$output .= '<info>Console Tool</info>';
}

return $output;
}

public function setLauncherVersion ($launcherVersion) {
$this->launcherVersion = $launcherVersion;
}

public function getLauncherVersion ($launcherVersion) {
return $this->launcherVersion;
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit ee8fb83

Please sign in to comment.