Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
117 lines (98 loc) · 3.25 KB

File metadata and controls

117 lines (98 loc) · 3.25 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
declare(strict_types=1);
namespace PanicDevs\Modules\Console;
use Illuminate\Console\Command;
use PanicDevs\Modules\ManifestBuilder;
/**
* ModuleListCommand
*
* Console command for listing all modules with their current status.
* Provides filtering options to show only enabled or disabled modules.
* Displays modules organized by type with priority information.
*
* Usage:
* - php artisan modules:list # List all modules
* - php artisan modules:list --enabled # Show only enabled modules
* - php artisan modules:list --disabled # Show only disabled modules
*
* @package PanicDevs\Modules\Console
* @author PanicDevs
* @since 1.0.0
*/
class ModuleListCommand extends Command
{
protected $signature = 'modules:list {--enabled : Show only enabled modules} {--disabled : Show only disabled modules}';
protected $description = 'List all modules with their status';
/**
* Execute the console command.
*
* Lists all modules with filtering options and displays summary statistics.
*/
public function handle(): void
{
$builder = new ManifestBuilder();
$modules = $builder->build();
$showEnabled = $this->option('enabled');
$showDisabled = $this->option('disabled');
// If both or neither are specified, show all
if (($showEnabled && $showDisabled) || (!$showEnabled && !$showDisabled))
{
$showEnabled = $showDisabled = true;
}
$this->info('📦 Module Status Overview');
$this->line('');
// Group modules by type
$modulesByType = [];
foreach ($modules as $moduleName => $module)
{
$type = $module['type'] ?? 'unknown';
$modulesByType[$type][] = $module;
}
foreach ($modulesByType as $type => $typeModules)
{
$this->line("📁 <fg=yellow>".ucfirst($type)." Modules</>");
foreach ($typeModules as $module)
{
$enabled = $module['enabled'];
// Filter based on options
if (!$showEnabled && $enabled)
{
continue;
}
if (!$showDisabled && !$enabled)
{
continue;
}
$status = $enabled ? '<fg=green>✅ Enabled</>' : '<fg=red>❌ Disabled</>';
$priority = ' (Priority: '.($module['priority'] ?? 0).')';
$this->line(" {$module['name']}: {$status}{$priority}");
}
$this->line('');
}
// Summary
$enabledCount = 0;
$disabledCount = 0;
foreach ($modules as $module)
{
if ($module['enabled'])
{
$enabledCount++;
} else
{
$disabledCount++;
}
}
$this->info("📊 Summary: {$enabledCount} enabled, {$disabledCount} disabled modules");
}
/**
* Get available filtering options.
*/
protected function getFilterOptions(): array
{
return [
'all' => 'All modules',
'enabled' => 'Enabled only',
'disabled' => 'Disabled only',
];
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.