Skip to content

Commit 2509df9

Browse files
committed
wip
1 parent ee1ee81 commit 2509df9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

app/Commands/DetectCommand.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,21 @@
88

99
class DetectCommand extends Command
1010
{
11-
protected $signature = 'detect {code} {--debug} {--from-file=}';
11+
protected $signature = 'detect {path} {--debug} {--from-file=}';
1212

1313
protected $description = 'Detect things we care about in the current code';
1414

1515
public function handle(): void
1616
{
17-
$code = $this->argument('code');
18-
1917
if ($this->option('from-file')) {
2018
$code = file_get_contents(__DIR__ . '/../../tests/snippets/detect/' . $this->option('from-file') . '.php');
19+
} else {
20+
try {
21+
$code = file_get_contents($this->argument('path'));
22+
} catch (\Exception $e) {
23+
echo json_encode([]);
24+
return;
25+
}
2126
}
2227

2328
$walker = new DetectWalker($code, (bool) $this->option('debug'));

0 commit comments

Comments
 (0)