add choice list to install & update artisan commands

This commit is contained in:
Boy132 2025-08-04 11:28:07 +02:00
parent be404a8332
commit abf6349918
3 changed files with 9 additions and 5 deletions

View File

@ -11,7 +11,7 @@ class ComposerPluginsCommand extends Command
{
protected $signature = 'p:plugin:composer';
protected $description = 'Runs composer require on all installed plugins.';
protected $description = 'Runs "composer require" on all installed plugins.';
public function handle(): void
{

View File

@ -8,14 +8,16 @@ use Illuminate\Console\Command;
class InstallPluginCommand extends Command
{
protected $signature = 'p:plugin:install {id}';
protected $signature = 'p:plugin:install {--id=}';
protected $description = 'Installs a plugin';
public function handle(): void
{
$id = $this->option('id') ?? $this->choice('Plugin', Plugin::pluck('name', 'id')->toArray());
/** @var ?Plugin $plugin */
$plugin = Plugin::where('id', $this->argument('id'))->first();
$plugin = Plugin::where('id', $id)->first();
if (!$plugin) {
$this->error('Plugin does not exist!');

View File

@ -8,14 +8,16 @@ use Illuminate\Console\Command;
class UpdatePluginCommand extends Command
{
protected $signature = 'p:plugin:update {id}';
protected $signature = 'p:plugin:update {--id=}';
protected $description = 'Updates a plugin';
public function handle(): void
{
$id = $this->option('id') ?? $this->choice('Plugin', Plugin::pluck('name', 'id')->toArray());
/** @var ?Plugin $plugin */
$plugin = Plugin::where('id', $this->argument('id'))->first();
$plugin = Plugin::where('id', $id)->first();
if (!$plugin) {
$this->error('Plugin does not exist!');