ProcessCommand: show only changed files

This commit is contained in:
TomasVotruba 2017-12-20 02:36:48 +01:00
parent 35edf6e521
commit d40065cefb

View File

@ -141,18 +141,17 @@ final class ProcessCommand extends Command
$i = 1;
foreach ($fileInfos as $fileInfo) {
if ($this->parameterProvider->provideParameter(self::OPTION_DRY_RUN)) {
$this->symfonyStyle->writeln(sprintf('<options=bold>%d) %s</>', $i, $fileInfo->getPathname()));
$oldContent = $fileInfo->getContents();
$newContent = $this->fileProcessor->processFileToString($fileInfo);
if ($newContent !== $oldContent) {
$this->symfonyStyle->writeln(sprintf('<options=bold>%d) %s</>', $i, $fileInfo->getPathname()));
$this->symfonyStyle->writeln($this->differAndFormatter->diffAndFormat($oldContent, $newContent));
++$i;
}
} else {
$this->fileProcessor->processFile($fileInfo);
}
++$i;
}
}
}