Skip to content

Commit 724142b

Browse files
committed
Replaced InputOption with InputArgument for the Compare Command.
Options were not the appropriate input type to use as source-before and source-after are required for the command to properly run.
1 parent a1a92ed commit 724142b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ After the inspection is completed, you are given a list of changes that have occ
2828
## Example
2929

3030
```bash
31-
php bin/php-semver-checker compare --before-source laravel-4.2.15 --after-source laravel-4.2.16
31+
php bin/php-semver-checker compare laravel-4.2.15 laravel-4.2.16
3232

3333
Suggested semantic versioning change: MAJOR
3434

src/PHPSemVerChecker/Console/Command/CompareCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
use PHPSemVerChecker\Scanner\Scanner;
88
use Symfony\Component\Console\Command\Command;
99
use Symfony\Component\Console\Helper\ProgressBar;
10+
use Symfony\Component\Console\Input\InputArgument;
1011
use Symfony\Component\Console\Input\InputInterface;
11-
use Symfony\Component\Console\Input\InputOption;
1212
use Symfony\Component\Console\Output\OutputInterface;
1313

1414
class CompareCommand extends Command {
@@ -18,8 +18,8 @@ protected function configure()
1818
->setName('compare')
1919
->setDescription('Compare a set of files to determine what semantic versioning change needs to be done')
2020
->setDefinition([
21-
new InputOption('source-before', null, InputOption::VALUE_REQUIRED, 'A single file to check'),
22-
new InputOption('source-after', null, InputOption::VALUE_REQUIRED, 'A single file to check against'),
21+
new InputArgument('source-before', InputArgument::REQUIRED, 'A directory to check'),
22+
new InputArgument('source-after', InputArgument::REQUIRED, 'A directory to check against'),
2323
]);
2424
}
2525

@@ -29,10 +29,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
2929
$beforeScanner = new Scanner();
3030
$afterScanner = new Scanner();
3131

32-
$beforeFiles = $input->getOption('source-before');
32+
$beforeFiles = $input->getArgument('source-before');
3333
$beforeFiles = $fileIterator->getFilesAsArray($beforeFiles, '.php');
3434

35-
$afterFiles = $input->getOption('source-after');
35+
$afterFiles = $input->getArgument('source-after');
3636
$afterFiles = $fileIterator->getFilesAsArray($afterFiles, '.php');
3737

3838
$progress = new ProgressBar($output, count($beforeFiles) + count($afterFiles));

0 commit comments

Comments
 (0)