forked from Terrorboy/ci4lang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli
43 lines (34 loc) · 1000 Bytes
/
cli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env php
<?php declare(strict_types=1);
// @ CLI 정리
$cli = $argv??[];
$run = $cli[1]??null;
// @ 공통 실행
// * composer install
if (file_exists('vendor/autoload.php') === false) {
passthru('composer install');
}
// * composer update
passthru('composer update --ansi');
// * git submodule update
passthru('git submodule init && git submodule update --recursive --remote');
require_once('vendor/autoload.php');
require_once(__DIR__ . '/vendor/codeigniter4/codeigniter4/system/Test/bootstrap.php');
use CodeIgniter\CLI\CLI;
use ci4lang\Ci4lang;
// @ run
if ($run == 'web') {
$port = $cli[2]??8000;
passthru('php -S 0.0.0.0:'.$port.' index.php');
} else {
$locale = $cli[2]??null;
if ($locale === null) {
$locale = CLI::prompt('Enter locale: ');
if (empty($locale)) {
CLI::write('Locale is empty.', 'light_gray', 'red');
exit;
}
}
$ci4lang = new Ci4lang\Ci4langClass($locale);
$ci4lang->cli();
}