#add git monitor
This commit is contained in:
@@ -18,16 +18,15 @@ class EnvCommand extends Command
|
||||
|
||||
private EnvService $envManager;
|
||||
|
||||
public function __construct(EnvService $envManager)
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->envManager = $envManager;
|
||||
}
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$action = $this->argument('action');
|
||||
|
||||
$this->envManager ??= app(EnvService::class);
|
||||
try {
|
||||
switch ($action) {
|
||||
case 'list':
|
||||
@@ -93,7 +92,7 @@ class EnvCommand extends Command
|
||||
private function listEnvironments(): int
|
||||
{
|
||||
$project = $this->option('project');
|
||||
|
||||
|
||||
if (!$project) {
|
||||
$this->error('请指定项目名称: --project=项目名');
|
||||
return 1;
|
||||
@@ -136,7 +135,7 @@ class EnvCommand extends Command
|
||||
|
||||
if ($this->confirm("确定要将 {$environment} 环境应用到项目 {$project} 吗?")) {
|
||||
$success = $this->envManager->applyEnv($project, $environment);
|
||||
|
||||
|
||||
if ($success) {
|
||||
$this->info("成功将 {$environment} 环境应用到项目 {$project}");
|
||||
return 0;
|
||||
@@ -178,7 +177,7 @@ class EnvCommand extends Command
|
||||
}
|
||||
|
||||
$success = $this->envManager->saveEnv($project, $environment, $content);
|
||||
|
||||
|
||||
if ($success) {
|
||||
$this->info("成功保存环境配置 {$project}/{$environment}");
|
||||
return 0;
|
||||
@@ -202,7 +201,7 @@ class EnvCommand extends Command
|
||||
}
|
||||
|
||||
$success = $this->envManager->importFromProject($project, $environment);
|
||||
|
||||
|
||||
if ($success) {
|
||||
$this->info("成功从项目 {$project} 导入环境配置为 {$environment}");
|
||||
return 0;
|
||||
@@ -227,7 +226,7 @@ class EnvCommand extends Command
|
||||
|
||||
if ($this->confirm("确定要删除环境配置 {$project}/{$environment} 吗?")) {
|
||||
$success = $this->envManager->deleteEnv($project, $environment);
|
||||
|
||||
|
||||
if ($success) {
|
||||
$this->info("成功删除环境配置 {$project}/{$environment}");
|
||||
return 0;
|
||||
@@ -359,9 +358,9 @@ class EnvCommand extends Command
|
||||
$bytes = max($bytes, 0);
|
||||
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
|
||||
$pow = min($pow, count($units) - 1);
|
||||
|
||||
|
||||
$bytes /= pow(1024, $pow);
|
||||
|
||||
|
||||
return round($bytes, 2) . ' ' . $units[$pow];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user