fix: Use comfy-table crate for table rendering
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -38,7 +38,7 @@ lz4_flex = "0.11.1"
|
|||||||
magic = "0.13.0"
|
magic = "0.13.0"
|
||||||
nix = "0.30.1"
|
nix = "0.30.1"
|
||||||
once_cell = "1.19.0"
|
once_cell = "1.19.0"
|
||||||
prettytable-rs = "0.10.0"
|
comfy-table = "0.3.1"
|
||||||
pwhash = "1.0.0"
|
pwhash = "1.0.0"
|
||||||
regex = "1.9.5"
|
regex = "1.9.5"
|
||||||
ringbuf = "0.3"
|
ringbuf = "0.3"
|
||||||
|
|||||||
@@ -9,15 +9,16 @@ use crate::config;
|
|||||||
use crate::common::status::StatusInfo;
|
use crate::common::status::StatusInfo;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use serde_yaml;
|
use serde_yaml;
|
||||||
use prettytable::{Attr, Cell, Row, Table};
|
use comfy_table::{Table, ContentArrangement, Cell, Color};
|
||||||
use prettytable::format::consts::{FORMAT_BOX_CHARS, FORMAT_NO_BORDER_LINE_SEPARATOR};
|
use comfy_table::presets::UTF8_FULL;
|
||||||
|
use comfy_table::modifiers::UTF8_ROUND_CORNERS;
|
||||||
|
|
||||||
use crate::common::status::PathInfo;
|
use crate::common::status::PathInfo;
|
||||||
use crate::meta_plugin::MetaPluginType;
|
use crate::meta_plugin::MetaPluginType;
|
||||||
use crate::meta_plugin::get_meta_plugin;
|
use crate::meta_plugin::get_meta_plugin;
|
||||||
|
|
||||||
fn build_path_table(path_info: &PathInfo) -> ComfyTable {
|
fn build_path_table(path_info: &PathInfo) -> Table {
|
||||||
let mut path_table = ComfyTable::new();
|
let mut path_table = Table::new();
|
||||||
|
|
||||||
if std::io::stdout().is_terminal() {
|
if std::io::stdout().is_terminal() {
|
||||||
path_table
|
path_table
|
||||||
@@ -28,8 +29,8 @@ fn build_path_table(path_info: &PathInfo) -> ComfyTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
path_table.set_header(vec![
|
path_table.set_header(vec![
|
||||||
Cell::new("Type").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Type").add_attribute(comfy_table::Attribute::Bold),
|
||||||
Cell::new("Path").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Path").add_attribute(comfy_table::Attribute::Bold),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
path_table.add_row(vec!["Data", &path_info.data]);
|
path_table.add_row(vec!["Data", &path_info.data]);
|
||||||
@@ -39,8 +40,8 @@ fn build_path_table(path_info: &PathInfo) -> ComfyTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn build_config_table(settings: &config::Settings) -> ComfyTable {
|
fn build_config_table(settings: &config::Settings) -> Table {
|
||||||
let mut config_table = ComfyTable::new();
|
let mut config_table = Table::new();
|
||||||
if std::io::stdout().is_terminal() {
|
if std::io::stdout().is_terminal() {
|
||||||
config_table
|
config_table
|
||||||
.load_preset(UTF8_FULL)
|
.load_preset(UTF8_FULL)
|
||||||
@@ -50,8 +51,8 @@ fn build_config_table(settings: &config::Settings) -> ComfyTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config_table.set_header(vec![
|
config_table.set_header(vec![
|
||||||
Cell::new("Setting").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Setting").add_attribute(comfy_table::Attribute::Bold),
|
||||||
Cell::new("Value").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Value").add_attribute(comfy_table::Attribute::Bold),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Add relevant configuration settings
|
// Add relevant configuration settings
|
||||||
|
|||||||
@@ -43,17 +43,17 @@ use crate::modes::common::OutputFormat;
|
|||||||
use crate::config;
|
use crate::config;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use serde_yaml;
|
use serde_yaml;
|
||||||
use comfytable::{ComfyTable, ContentArrangement, Row, Cell, Alignment};
|
use comfy_table::{Table, ContentArrangement, Row, Cell, Color};
|
||||||
use comfytable::presets::UTF8_FULL;
|
use comfy_table::presets::UTF8_FULL;
|
||||||
use comfytable::modifiers::UTF8_ROUND_CORNERS;
|
use comfy_table::modifiers::UTF8_ROUND_CORNERS;
|
||||||
|
|
||||||
use crate::meta_plugin::{MetaPluginType, get_meta_plugin};
|
use crate::meta_plugin::{MetaPluginType, get_meta_plugin};
|
||||||
use crate::common::status::{MetaPluginInfo, CompressionInfo};
|
use crate::common::status::{MetaPluginInfo, CompressionInfo};
|
||||||
use prettytable::color;
|
use prettytable::color;
|
||||||
|
|
||||||
|
|
||||||
fn build_meta_plugin_table(meta_plugin_info: &std::collections::HashMap<String, MetaPluginInfo>) -> ComfyTable {
|
fn build_meta_plugin_table(meta_plugin_info: &std::collections::HashMap<String, MetaPluginInfo>) -> Table {
|
||||||
let mut meta_plugin_table = ComfyTable::new();
|
let mut meta_plugin_table = Table::new();
|
||||||
if std::io::stdout().is_terminal() {
|
if std::io::stdout().is_terminal() {
|
||||||
meta_plugin_table
|
meta_plugin_table
|
||||||
.load_preset(UTF8_FULL)
|
.load_preset(UTF8_FULL)
|
||||||
@@ -63,9 +63,9 @@ fn build_meta_plugin_table(meta_plugin_info: &std::collections::HashMap<String,
|
|||||||
}
|
}
|
||||||
|
|
||||||
meta_plugin_table.set_header(vec![
|
meta_plugin_table.set_header(vec![
|
||||||
Cell::new("Plugin Name").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Plugin Name").add_attribute(comfy_table::Attribute::Bold),
|
||||||
Cell::new("Options").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Options").add_attribute(comfy_table::Attribute::Bold),
|
||||||
Cell::new("Outputs").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Outputs").add_attribute(comfy_table::Attribute::Bold),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Sort meta plugin info by plugin name
|
// Sort meta plugin info by plugin name
|
||||||
@@ -120,8 +120,8 @@ fn build_meta_plugin_table(meta_plugin_info: &std::collections::HashMap<String,
|
|||||||
meta_plugin_table
|
meta_plugin_table
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_compression_table(compression_info: &Vec<CompressionInfo>) -> ComfyTable {
|
fn build_compression_table(compression_info: &Vec<CompressionInfo>) -> Table {
|
||||||
let mut compression_table = ComfyTable::new();
|
let mut compression_table = Table::new();
|
||||||
if std::io::stdout().is_terminal() {
|
if std::io::stdout().is_terminal() {
|
||||||
compression_table
|
compression_table
|
||||||
.load_preset(UTF8_FULL)
|
.load_preset(UTF8_FULL)
|
||||||
@@ -131,27 +131,27 @@ fn build_compression_table(compression_info: &Vec<CompressionInfo>) -> ComfyTabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
compression_table.set_header(vec![
|
compression_table.set_header(vec![
|
||||||
Cell::new("Type").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Type").add_attribute(comfy_table::Attribute::Bold),
|
||||||
Cell::new("Found").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Found").add_attribute(comfy_table::Attribute::Bold),
|
||||||
Cell::new("Enabled").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Enabled").add_attribute(comfy_table::Attribute::Bold),
|
||||||
Cell::new("Binary").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Binary").add_attribute(comfy_table::Attribute::Bold),
|
||||||
Cell::new("Compress").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Compress").add_attribute(comfy_table::Attribute::Bold),
|
||||||
Cell::new("Decompress").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Decompress").add_attribute(comfy_table::Attribute::Bold),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
for info in compression_info {
|
for info in compression_info {
|
||||||
compression_table.add_row(vec![
|
compression_table.add_row(vec![
|
||||||
info.compression_type.clone(),
|
info.compression_type.clone(),
|
||||||
match info.found {
|
match info.found {
|
||||||
true => Cell::new("Yes").fg(comfytable::Color::Green),
|
true => Cell::new("Yes").fg(Color::Green),
|
||||||
false => Cell::new("No").fg(comfytable::Color::Red),
|
false => Cell::new("No").fg(Color::Red),
|
||||||
},
|
},
|
||||||
match info.default {
|
match info.default {
|
||||||
true => Cell::new("Yes").fg(comfytable::Color::Green),
|
true => Cell::new("Yes").fg(Color::Green),
|
||||||
false => Cell::new("No"),
|
false => Cell::new("No"),
|
||||||
},
|
},
|
||||||
match info.binary.as_str() {
|
match info.binary.as_str() {
|
||||||
"<INTERNAL>" => Cell::new(&info.binary).fg(comfytable::Color::DarkGrey),
|
"<INTERNAL>" => Cell::new(&info.binary).fg(Color::DarkGrey),
|
||||||
_ => Cell::new(&info.binary),
|
_ => Cell::new(&info.binary),
|
||||||
},
|
},
|
||||||
info.compress.clone(),
|
info.compress.clone(),
|
||||||
@@ -162,8 +162,8 @@ fn build_compression_table(compression_info: &Vec<CompressionInfo>) -> ComfyTabl
|
|||||||
compression_table
|
compression_table
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_filter_plugin_table(filter_plugins: &Vec<crate::common::status::FilterPluginInfo>) -> ComfyTable {
|
fn build_filter_plugin_table(filter_plugins: &Vec<crate::common::status::FilterPluginInfo>) -> Table {
|
||||||
let mut filter_plugin_table = ComfyTable::new();
|
let mut filter_plugin_table = Table::new();
|
||||||
if std::io::stdout().is_terminal() {
|
if std::io::stdout().is_terminal() {
|
||||||
filter_plugin_table
|
filter_plugin_table
|
||||||
.load_preset(UTF8_FULL)
|
.load_preset(UTF8_FULL)
|
||||||
@@ -173,9 +173,9 @@ fn build_filter_plugin_table(filter_plugins: &Vec<crate::common::status::FilterP
|
|||||||
}
|
}
|
||||||
|
|
||||||
filter_plugin_table.set_header(vec![
|
filter_plugin_table.set_header(vec![
|
||||||
Cell::new("Plugin Name").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Plugin Name").add_attribute(comfy_table::Attribute::Bold),
|
||||||
Cell::new("Options").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Options").add_attribute(comfy_table::Attribute::Bold),
|
||||||
Cell::new("Description").add_attribute(comfytable::Attribute::Bold),
|
Cell::new("Description").add_attribute(comfy_table::Attribute::Bold),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Sort plugins by name
|
// Sort plugins by name
|
||||||
|
|||||||
Reference in New Issue
Block a user