Skip to content

Commit

Permalink
add shot options constant
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Jun 22, 2021
1 parent 77a90c5 commit ff3de64
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
15 changes: 15 additions & 0 deletions src/Configuration/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ final class Option
*/
public const DRY_RUN = 'dry-run';

/**
* @var string
*/
public const DRY_RUN_SHORT = 'n';

/**
* @var string
*/
Expand Down Expand Up @@ -142,4 +147,14 @@ final class Option
* @var string
*/
public const ENABLE_EDITORCONFIG = 'enable_editorconfig';

/**
* @var string
*/
public const AUTOLOAD_FILE_SHORT = 'a';

/**
* @var string
*/
public const OUTPUT_FORMAT_SHORT = 'o';
}
11 changes: 8 additions & 3 deletions src/Console/Command/ProcessCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,24 @@ protected function configure(): void

$this->addOption(
Option::DRY_RUN,
'n',
Option::DRY_RUN_SHORT,
InputOption::VALUE_NONE,
'See diff of changes, do not save them to files.'
);

$this->addOption(Option::AUTOLOAD_FILE, 'a', InputOption::VALUE_REQUIRED, 'File with extra autoload');
$this->addOption(
Option::AUTOLOAD_FILE,
Option::AUTOLOAD_FILE_SHORT,
InputOption::VALUE_REQUIRED,
'File with extra autoload'
);

$names = $this->outputFormatterCollector->getNames();

$description = sprintf('Select output format: "%s".', implode('", "', $names));
$this->addOption(
Option::OUTPUT_FORMAT,
'o',
Option::OUTPUT_FORMAT_SHORT,
InputOption::VALUE_OPTIONAL,
$description,
ConsoleOutputFormatter::NAME
Expand Down

0 comments on commit ff3de64

Please sign in to comment.