Skip to content

Commit

Permalink
[TASK] Simplify command name configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbelasichon committed Mar 11, 2020
1 parent 3af719d commit 53ccab8
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 22 deletions.
12 changes: 8 additions & 4 deletions src/Command/DeployCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ class DeployCommand extends Command
*/
private $factory;

public function __construct(FactoryInterface $factory, string $name = null)
/**
* @var string
*/
protected static $defaultName = 'deploy';

public function __construct(FactoryInterface $factory)
{
parent::__construct($name);
parent::__construct();
$this->factory = $factory;
}

protected function configure(): void
{
$this->setName('deploy')
->setDescription('Deploys the application with the given name')
$this->setDescription('Deploys the application with the given name')
->addArgument(
'deploymentName',
InputArgument::OPTIONAL,
Expand Down
12 changes: 8 additions & 4 deletions src/Command/DescribeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,20 @@ class DescribeCommand extends Command
*/
private $factory;

public function __construct(FactoryInterface $factory, string $name = null)
/**
* @var string
*/
protected static $defaultName = 'describe';

public function __construct(FactoryInterface $factory)
{
parent::__construct($name);
parent::__construct();
$this->factory = $factory;
}

protected function configure()
{
$this->setName('describe')
->setDescription('Describes the flow for the given name')
$this->setDescription('Describes the flow for the given name')
->addArgument(
'deploymentName',
InputArgument::REQUIRED,
Expand Down
12 changes: 8 additions & 4 deletions src/Command/RollbackCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ class RollbackCommand extends Command
*/
private $factory;

public function __construct(FactoryInterface $factory, string $name = null)
/**
* @var string
*/
protected static $defaultName = 'rollback';

public function __construct(FactoryInterface $factory)
{
parent::__construct($name);
parent::__construct();
$this->factory = $factory;
}

protected function configure(): void
{
$this->setName('rollback')
->setDescription('Rollback current to previous release and remove current folder')
$this->setDescription('Rollback current to previous release and remove current folder')
->addArgument(
'deploymentName',
InputArgument::OPTIONAL,
Expand Down
8 changes: 6 additions & 2 deletions src/Command/SelfUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@

class SelfUpdateCommand extends Command
{
/**
* @var string
*/
protected static $defaultName = 'self-update';

public function isEnabled(): bool
{
return Phar::running() !== '';
}

protected function configure(): void
{
$this->setName('self-update')
->addOption(
$this->addOption(
'stability',
null,
InputOption::VALUE_OPTIONAL,
Expand Down
12 changes: 8 additions & 4 deletions src/Command/ShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,20 @@ class ShowCommand extends Command
*/
private $factory;

public function __construct(FactoryInterface $factory, string $name = null)
/**
* @var string
*/
protected static $defaultName = 'show';

public function __construct(FactoryInterface $factory)
{
parent::__construct($name);
parent::__construct();
$this->factory = $factory;
}

protected function configure(): void
{
$this->setName('show')
->setDescription('Shows all the deployments depending on the directory configuration')
$this->setDescription('Shows all the deployments depending on the directory configuration')
->addOption(
'configurationPath',
null,
Expand Down
12 changes: 8 additions & 4 deletions src/Command/SimulateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ class SimulateCommand extends Command
*/
private $factory;

public function __construct(FactoryInterface $factory, string $name = null)
/**
* @var string
*/
protected static $defaultName = 'simulate';

public function __construct(FactoryInterface $factory)
{
parent::__construct($name);
parent::__construct();
$this->factory = $factory;
}

protected function configure(): void
{
$this->setName('simulate')
->setDescription('Simulates the deployment for the given name')
$this->setDescription('Simulates the deployment for the given name')
->addArgument(
'deploymentName',
InputArgument::OPTIONAL,
Expand Down

0 comments on commit 53ccab8

Please sign in to comment.