castopod/modules/Plugins/Commands/BaseCommand.php
Yassine Doghri 3d0db5c64a feat(plugins): add spark commands to install, add, update and remove plugins using adaures' cpm
update js & php dependencies to latest and fix rector, phpstan and ecs issues
2025-09-22 17:34:36 +00:00

47 lines
977 B
PHP

<?php
declare(strict_types=1);
namespace Modules\Plugins\Commands;
use Castopod\PluginsManager\Logger\PluginsManagerLogger;
use CodeIgniter\CLI\BaseCommand as CodeIgniterBaseCommand;
use CodeIgniter\CLI\CLI;
class BaseCommand extends CodeIgniterBaseCommand
{
/**
* The Command's Group
*
* @var string
*/
protected $group = 'Plugins';
/**
* The Command's Options
*
* @var array<string,string>
*/
protected $options = [
'--debug' => 'Get log trace to follow what is happening under the hood.',
];
/**
* Actually execute a command.
*
* @param array<int,string> $params
*
* @return int|void
*/
public function run(array $params)
{
if (CLI::getOption('debug')) {
PluginsManagerLogger::$formatter = CpmFormatterDebug::class;
} else {
PluginsManagerLogger::$formatter = CpmFormatter::class;
}
return 0;
}
}