mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-22 00:05:37 +08:00
add composer library mode
This commit is contained in:
8
bin/spc
8
bin/spc
@@ -4,7 +4,13 @@
|
|||||||
use SPC\ConsoleApplication;
|
use SPC\ConsoleApplication;
|
||||||
use SPC\exception\ExceptionHandler;
|
use SPC\exception\ExceptionHandler;
|
||||||
|
|
||||||
require_once __DIR__ . '/../vendor/autoload.php';
|
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';
|
||||||
|
}
|
||||||
|
|
||||||
// 防止 Micro 打包状态下不支持中文的显示(虽然这个项目目前好像没输出过中文?)
|
// 防止 Micro 打包状态下不支持中文的显示(虽然这个项目目前好像没输出过中文?)
|
||||||
if (PHP_OS_FAMILY === 'Windows' && Phar::running()) {
|
if (PHP_OS_FAMILY === 'Windows' && Phar::running()) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
|||||||
use ZM\Logger\ConsoleLogger;
|
use ZM\Logger\ConsoleLogger;
|
||||||
|
|
||||||
define('WORKING_DIR', getcwd());
|
define('WORKING_DIR', getcwd());
|
||||||
const ROOT_DIR = __DIR__ . '/../..';
|
define('ROOT_DIR', dirname(__DIR__, 2));
|
||||||
|
|
||||||
// CLI start time
|
// CLI start time
|
||||||
define('START_TIME', microtime(true));
|
define('START_TIME', microtime(true));
|
||||||
|
|||||||
Reference in New Issue
Block a user