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