mirror of
http://shenjack.top:5100/shenjack/icalingua-python-bot.git
synced 2025-04-20 05:39:54 +08:00
更好看的状态显示
This commit is contained in:
parent
15b3e328d4
commit
3c5cf2e92c
|
@ -1,5 +1,6 @@
|
||||||
use std::{path::Path, str::FromStr};
|
use std::{path::Path, str::FromStr};
|
||||||
|
|
||||||
|
use colored::Colorize;
|
||||||
use toml_edit::{value, DocumentMut, Key, Table, TomlError, Value};
|
use toml_edit::{value, DocumentMut, Key, Table, TomlError, Value};
|
||||||
use tracing::{event, Level};
|
use tracing::{event, Level};
|
||||||
|
|
||||||
|
@ -135,16 +136,20 @@ impl PluginConfigFile {
|
||||||
}
|
}
|
||||||
event!(Level::INFO, "同步插件状态");
|
event!(Level::INFO, "同步插件状态");
|
||||||
let plugins = PyStatus::get_mut();
|
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)| {
|
plugins.files.iter_mut().for_each(|(path, status)| {
|
||||||
let plugin_id = status.get_id();
|
let plugin_id = status.get_id();
|
||||||
let config_status = self.get_status(&plugin_id);
|
let config_status = self.get_status(&plugin_id);
|
||||||
event!(
|
event!(
|
||||||
Level::INFO,
|
Level::INFO,
|
||||||
"插件状态: {}({:?}) {} -> {}",
|
"插件状态: {} {} -> {}",
|
||||||
status.get_id(),
|
status.get_id(),
|
||||||
path,
|
fmt_bool(status.enabled),
|
||||||
status.enabled,
|
fmt_bool(config_status)
|
||||||
config_status
|
|
||||||
);
|
);
|
||||||
status.enabled = config_status;
|
status.enabled = config_status;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user