Skip to content

Commit

Permalink
Fix usage when both stdin and -f argument are available
Browse files Browse the repository at this point in the history
  • Loading branch information
ostrolucky committed Dec 27, 2018
1 parent d471fe7 commit 81880ba
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
(new SymfonyStyle($input, $output))->error($message);
};

if (!$hasStdin && !$filePath) {
$errorHandler('Please pipe stdin into '.APP_NAME.', or provide file path via --file option');
if (!$hasStdin) {
if (!$filePath) {
$errorHandler("Path $filePath does not exist!");

return 1;
} elseif ($filePath && !file_exists($filePath)) {
$errorHandler("Path $filePath does not exist!");
return 1;
} elseif (!file_exists($filePath)) {
$errorHandler('Please pipe stdin into ' . APP_NAME . ', or provide file path via --file option');

return 1;
return 1;
}
}

$logger = new ConsoleLogger($firstSection = $output->section());
Expand Down

0 comments on commit 81880ba

Please sign in to comment.