From dbbdba43e1dcd2c3857e5609f44981c4c291ee1d Mon Sep 17 00:00:00 2001 From: Arvin <62139570+wnlen@users.noreply.github.com> Date: Sun, 22 Mar 2026 18:02:37 +0800 Subject: [PATCH] Update clashctl --- clashctl | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/clashctl b/clashctl index 847b605..b2248d9 100755 --- a/clashctl +++ b/clashctl @@ -837,20 +837,22 @@ cmd_status() { local pid="-" local controller="-" local dashboard_url="-" - local config_source="-" - local generate_status="-" - local generate_reason="-" - local generate_at="-" - local run_status="-" - local run_mode="-" - local run_pid="-" - local run_at="-" local http_port="-" local dashboard_port="-" local secret_status="未配置" local config_exists="否" local state_exists="否" + # 配置与运行(仅在有值时显示) + local gen_status="" + local gen_reason="" + local cfg_source="" + local gen_time="" + local run_result="" + local run_mode="" + local run_pid="" + local start_time="" + mode="$(detect_mode)" case "$mode" in @@ -921,16 +923,16 @@ cmd_status() { ui_summary_end ui_blank - if [ -n "$gen_status$gen_reason$config_source$gen_time$run_result$run_mode$run_pid$start_time" ]; then + if [ -n "${gen_status:-}${gen_reason:-}${cfg_source:-}${gen_time:-}${run_result:-}${run_mode:-}${run_pid:-}${start_time:-}" ]; then ui_summary_begin "配置与运行" - [ -n "$gen_status" ] && ui_summary_row "生成状态" "$gen_status" - [ -n "$gen_reason" ] && ui_summary_row "失败原因" "$gen_reason" - [ -n "$config_source" ] && ui_summary_row "配置来源" "$config_source" - [ -n "$gen_time" ] && ui_summary_row "生成时间" "$gen_time" - [ -n "$run_result" ] && ui_summary_row "运行结果" "$run_result" - [ -n "$run_mode" ] && ui_summary_row "运行方式" "$run_mode" - [ -n "$run_pid" ] && ui_summary_row "运行进程" "$run_pid" - [ -n "$start_time" ] && ui_summary_row "启动时间" "$start_time" + [ -n "${gen_status:-}" ] && ui_summary_row "生成状态" "$gen_status" + [ -n "${gen_reason:-}" ] && ui_summary_row "失败原因" "$gen_reason" + [ -n "${cfg_source:-}" ] && ui_summary_row "配置来源" "$cfg_source" + [ -n "${gen_time:-}" ] && ui_summary_row "生成时间" "$gen_time" + [ -n "${run_result:-}" ] && ui_summary_row "运行结果" "$run_result" + [ -n "${run_mode:-}" ] && ui_summary_row "运行方式" "$run_mode" + [ -n "${run_pid:-}" ] && ui_summary_row "运行进程" "$run_pid" + [ -n "${start_time:-}" ] && ui_summary_row "启动时间" "$start_time" ui_summary_end fi