31 lines
888 B
Plaintext
Raw Normal View History

2023-03-28 23:42:43 +08:00
#!/usr/bin/env php
2023-03-18 17:32:21 +08:00
<?php
2025-11-30 15:35:04 +08:00
use StaticPHP\ConsoleApplication;
use StaticPHP\Exception\ExceptionHandler;
use StaticPHP\Exception\SPCException;
2023-12-24 14:43:47 +08:00
if (file_exists(dirname(__DIR__) . '/vendor/autoload.php')) {
// Current: ./bin (git/project mode)
require_once dirname(__DIR__) . '/vendor/autoload.php';
} else {
// Current: ./vendor/crazywhalecc/static-php-cli/bin (composer library mode)
require_once dirname(__DIR__, 3) . '/autoload.php';
}
2023-03-18 17:32:21 +08:00
// Print deprecation notice on PHP < 8.4, use red and highlight background
if (PHP_VERSION_ID < 80400) {
echo "\e[43mDeprecation Notice: PHP < 8.4 is deprecated, please upgrade your PHP version.\e[0m\n";
}
2023-03-18 17:32:21 +08:00
try {
(new ConsoleApplication())->run();
2025-11-30 15:35:04 +08:00
} catch (SPCException $e) {
ExceptionHandler::handleSPCException($e);
exit(1);
} catch (\Throwable $e) {
ExceptionHandler::handleDefaultException($e);
2024-01-10 21:08:25 +08:00
exit(1);
2023-03-18 17:32:21 +08:00
}
2025-11-30 15:35:04 +08:00