From 3c5cf2e92c708d61367e483d18c838bcff89b7c2 Mon Sep 17 00:00:00 2001 From: shenjack-5600u <3695888@qq.com> Date: Mon, 7 Apr 2025 23:21:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E5=A5=BD=E7=9C=8B=E7=9A=84=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ica-rs/src/py/config.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ica-rs/src/py/config.rs b/ica-rs/src/py/config.rs index 518d7ec..615daa3 100644 --- a/ica-rs/src/py/config.rs +++ b/ica-rs/src/py/config.rs @@ -1,5 +1,6 @@ use std::{path::Path, str::FromStr}; +use colored::Colorize; use toml_edit::{value, DocumentMut, Key, Table, TomlError, Value}; use tracing::{event, Level}; @@ -135,16 +136,20 @@ impl PluginConfigFile { } event!(Level::INFO, "同步插件状态"); let plugins = PyStatus::get_mut(); + + fn fmt_bool(b: bool) -> String { + if b { "启用".green().to_string() } else { "禁用".red().to_string() } + } + plugins.files.iter_mut().for_each(|(path, status)| { let plugin_id = status.get_id(); let config_status = self.get_status(&plugin_id); event!( Level::INFO, - "插件状态: {}({:?}) {} -> {}", + "插件状态: {} {} -> {}", status.get_id(), - path, - status.enabled, - config_status + fmt_bool(status.enabled), + fmt_bool(config_status) ); status.enabled = config_status; });