style updates
This commit is contained in:
@@ -7,6 +7,7 @@ use Illuminate\Console\Command;
|
||||
final class InspectModulesCommand extends Command
|
||||
{
|
||||
protected $signature = 'module:inspect {name?} {--json}';
|
||||
|
||||
protected $description = 'Validate module manifests and display dependencies and providers.';
|
||||
|
||||
public function handle(): int
|
||||
@@ -16,8 +17,14 @@ final class InspectModulesCommand extends Command
|
||||
$rows = [];
|
||||
foreach ($files as $file) {
|
||||
$manifest = json_decode((string) file_get_contents($file), true);
|
||||
if (! is_array($manifest)) { $this->error("Invalid JSON: {$file}"); return self::FAILURE; }
|
||||
if ($name && strcasecmp((string) ($manifest['name'] ?? ''), (string) $name) !== 0) { continue; }
|
||||
if (! is_array($manifest)) {
|
||||
$this->error("Invalid JSON: {$file}");
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
if ($name && strcasecmp((string) ($manifest['name'] ?? ''), (string) $name) !== 0) {
|
||||
continue;
|
||||
}
|
||||
$rows[] = [
|
||||
'name' => $manifest['name'] ?? basename(dirname($file)),
|
||||
'version' => $manifest['version'] ?? 'unknown',
|
||||
@@ -25,8 +32,13 @@ final class InspectModulesCommand extends Command
|
||||
'providers' => count($manifest['providers'] ?? []),
|
||||
];
|
||||
}
|
||||
if ($this->option('json')) { $this->line(json_encode($rows, JSON_PRETTY_PRINT)); return self::SUCCESS; }
|
||||
if ($this->option('json')) {
|
||||
$this->line(json_encode($rows, JSON_PRETTY_PRINT));
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
$this->table(['Module', 'Version', 'Requires', 'Providers'], $rows);
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user