2023-03-15 20:40:49 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC;
|
|
|
|
|
|
2023-09-12 16:27:07 +02:00
|
|
|
use SPC\command\BuildCliCommand;
|
|
|
|
|
use SPC\command\BuildLibsCommand;
|
|
|
|
|
use SPC\command\dev\AllExtCommand;
|
|
|
|
|
use SPC\command\dev\PhpVerCommand;
|
|
|
|
|
use SPC\command\dev\SortConfigCommand;
|
|
|
|
|
use SPC\command\DoctorCommand;
|
|
|
|
|
use SPC\command\DownloadCommand;
|
|
|
|
|
use SPC\command\DumpLicenseCommand;
|
|
|
|
|
use SPC\command\ExtractCommand;
|
|
|
|
|
use SPC\command\MicroCombineCommand;
|
2023-03-15 20:40:49 +08:00
|
|
|
use Symfony\Component\Console\Application;
|
|
|
|
|
use Symfony\Component\Console\Command\HelpCommand;
|
|
|
|
|
use Symfony\Component\Console\Command\ListCommand;
|
|
|
|
|
|
|
|
|
|
/**
|
2023-08-20 19:51:45 +08:00
|
|
|
* static-php-cli console app entry
|
2023-03-15 20:40:49 +08:00
|
|
|
*/
|
2023-09-12 16:27:07 +02:00
|
|
|
final class ConsoleApplication extends Application
|
2023-03-15 20:40:49 +08:00
|
|
|
{
|
2023-09-15 23:24:40 +08:00
|
|
|
public const VERSION = '2.0.0';
|
2023-03-15 20:40:49 +08:00
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
parent::__construct('static-php-cli', self::VERSION);
|
|
|
|
|
|
|
|
|
|
global $argv;
|
|
|
|
|
|
2023-08-20 19:51:45 +08:00
|
|
|
// Detailed debugging errors are not displayed in the production environment. Only the error display provided by Symfony console is used.
|
2023-03-15 20:40:49 +08:00
|
|
|
$this->setCatchExceptions(file_exists(ROOT_DIR . '/.prod') || !in_array('--debug', $argv));
|
|
|
|
|
|
2023-09-12 16:27:07 +02:00
|
|
|
$this->addCommands(
|
|
|
|
|
[
|
|
|
|
|
new BuildCliCommand(),
|
|
|
|
|
new BuildLibsCommand(),
|
|
|
|
|
new DoctorCommand(),
|
|
|
|
|
new DownloadCommand(),
|
|
|
|
|
new DumpLicenseCommand(),
|
|
|
|
|
new ExtractCommand(),
|
|
|
|
|
new MicroCombineCommand(),
|
|
|
|
|
|
|
|
|
|
// Dev commands
|
|
|
|
|
new AllExtCommand(),
|
|
|
|
|
new PhpVerCommand(),
|
|
|
|
|
new SortConfigCommand(),
|
|
|
|
|
]
|
|
|
|
|
);
|
2023-03-15 20:40:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function getDefaultCommands(): array
|
|
|
|
|
{
|
|
|
|
|
return [new HelpCommand(), new ListCommand()];
|
|
|
|
|
}
|
|
|
|
|
}
|