1212use PHPSemVerChecker \SemanticVersioning \Level ;
1313use PHPSemVerCheckerGit \Filter \SourceFilter ;
1414use RuntimeException ;
15- use Symfony \Component \Console \Command \Command ;
1615use Symfony \Component \Console \Helper \ProgressBar ;
1716use Symfony \Component \Console \Input \InputArgument ;
1817use Symfony \Component \Console \Input \InputInterface ;
2120use vierbergenlars \SemVer \expression as SemanticExpression ;
2221use vierbergenlars \SemVer \version as SemanticVersion ;
2322
24- class SuggestCommand extends Command
23+ class SuggestCommand extends BaseCommand
2524{
2625 protected function configure ()
2726 {
@@ -34,6 +33,7 @@ protected function configure()
3433 new InputOption ('against ' , 'a ' , InputOption::VALUE_REQUIRED , 'What to test against the tag (HEAD by default) ' ),
3534 new InputOption ('allow-detached ' , 'd ' , InputOption::VALUE_NONE , 'Allow suggest to start from a detached HEAD ' ),
3635 new InputOption ('details ' , null , InputOption::VALUE_NONE , 'Report the changes on which the suggestion is based ' ),
36+ new InputOption ('config ' , null , InputOption::VALUE_REQUIRED , 'A configuration file to configure php-semver-checker-git ' ),
3737 ]);
3838 }
3939
@@ -42,14 +42,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
4242 $ startTime = microtime (true );
4343
4444 $ targetDirectory = getcwd ();
45- $ tag = $ input -> getOption ('tag ' );
46- $ against = $ input -> getOption ('against ' ) ?: 'HEAD ' ;
45+ $ tag = $ this -> config -> get ('tag ' );
46+ $ against = $ this -> config -> get ('against ' ) ?: 'HEAD ' ;
4747
48- $ includeBefore = $ input -> getOption ('include-before ' );
49- $ excludeBefore = $ input -> getOption ('exclude-before ' );
48+ $ includeBefore = $ this -> config -> get ('include-before ' );
49+ $ excludeBefore = $ this -> config -> get ('exclude-before ' );
5050
51- $ includeAfter = $ input -> getOption ('include-after ' );
52- $ excludeAfter = $ input -> getOption ('exclude-after ' );
51+ $ includeAfter = $ this -> config -> get ('include-after ' );
52+ $ excludeAfter = $ this -> config -> get ('exclude-after ' );
5353
5454 $ client = new Client ();
5555
@@ -80,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8080
8181 $ initialBranch = $ repository ->getCurrentBranch ();
8282
83- if ( ! $ input -> getOption ('allow-detached ' ) && ! $ initialBranch ) {
83+ if ( ! $ this -> config -> get ('allow-detached ' ) && ! $ initialBranch ) {
8484 $ output ->writeln ('<error>You are on a detached HEAD, aborting.</error> ' );
8585 $ output ->writeln ('<info>If you still wish to run against a detached HEAD, use --allow-detached.</info> ' );
8686 return -1 ;
@@ -146,7 +146,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
146146 $ output ->writeln ('<info>Initial semantic version: ' . $ tag . '</info> ' );
147147 $ output ->writeln ('<info>Suggested semantic version: ' . $ newTag . '</info> ' );
148148
149- if ($ input -> getOption ('details ' )) {
149+ if ($ this -> config -> get ('details ' )) {
150150 $ reporter = new Reporter ($ report );
151151 $ reporter ->output ($ output );
152152 }
0 commit comments