Skip to content

Commit 3cf48c9

Browse files
authored
Merge pull request #100 from tighten/adc/graceful-dirty
Return 0 when no dirty files
2 parents db96e65 + dc22c6d commit 3cf48c9

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

app/Commands/FixCommand.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
use App\Support\ConfiguresForLintOrFix;
66
use App\Support\GetsCleaner;
7+
use Exception;
78
use LaravelZero\Framework\Commands\Command;
9+
use LaravelZero\Framework\Exceptions\ConsoleException;
810

911
class FixCommand extends Command
1012
{
@@ -17,8 +19,18 @@ class FixCommand extends Command
1719

1820
public function handle(): int
1921
{
20-
$clean = $this->getCleaner('fix', $this->input->getOption('using'));
22+
try {
23+
$clean = $this->getCleaner('fix', $this->input->getOption('using'));
2124

22-
return $clean->execute();
25+
return $clean->execute();
26+
} catch (ConsoleException $exception) {
27+
$this->error($exception->getMessage());
28+
29+
return $exception->getCode();
30+
} catch (Exception $exception) {
31+
$this->error($exception->getMessage());
32+
33+
return 1;
34+
}
2335
}
2436
}

app/Commands/LintCommand.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
use App\Support\ConfiguresForLintOrFix;
66
use App\Support\GetsCleaner;
7+
use Exception;
78
use LaravelZero\Framework\Commands\Command;
9+
use LaravelZero\Framework\Exceptions\ConsoleException;
810

911
class LintCommand extends Command
1012
{
@@ -17,8 +19,18 @@ class LintCommand extends Command
1719

1820
public function handle(): int
1921
{
20-
$clean = $this->getCleaner('lint', $this->input->getOption('using'));
22+
try {
23+
$clean = $this->getCleaner('lint', $this->input->getOption('using'));
2124

22-
return $clean->execute();
25+
return $clean->execute();
26+
} catch (ConsoleException $exception) {
27+
$this->error($exception->getMessage());
28+
29+
return $exception->getCode();
30+
} catch (Exception $exception) {
31+
$this->error($exception->getMessage());
32+
33+
return 1;
34+
}
2335
}
2436
}

builds/duster

130 Bytes
Binary file not shown.

config/app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
|
2727
*/
2828

29-
'version' => '1.1.0',
29+
'version' => '1.1.1',
3030

3131
/*
3232
|--------------------------------------------------------------------------

0 commit comments

Comments
 (0)