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:
Andrew Phillips
2025-09-08 17:59:58 -03:00
parent 007f5e2377
commit 15417eb1d3
3 changed files with 37 additions and 36 deletions

View File

@@ -9,15 +9,16 @@ use crate::config;
use crate::common::status::StatusInfo;
use serde_json;
use serde_yaml;
use prettytable::{Attr, Cell, Row, Table};
use prettytable::format::consts::{FORMAT_BOX_CHARS, FORMAT_NO_BORDER_LINE_SEPARATOR};
use comfy_table::{Table, ContentArrangement, Cell, Color};
use comfy_table::presets::UTF8_FULL;
use comfy_table::modifiers::UTF8_ROUND_CORNERS;
use crate::common::status::PathInfo;
use crate::meta_plugin::MetaPluginType;
use crate::meta_plugin::get_meta_plugin;
fn build_path_table(path_info: &PathInfo) -> ComfyTable {
let mut path_table = ComfyTable::new();
fn build_path_table(path_info: &PathInfo) -> Table {
let mut path_table = Table::new();
if std::io::stdout().is_terminal() {
path_table
@@ -28,8 +29,8 @@ fn build_path_table(path_info: &PathInfo) -> ComfyTable {
}
path_table.set_header(vec![
Cell::new("Type").add_attribute(comfytable::Attribute::Bold),
Cell::new("Path").add_attribute(comfytable::Attribute::Bold),
Cell::new("Type").add_attribute(comfy_table::Attribute::Bold),
Cell::new("Path").add_attribute(comfy_table::Attribute::Bold),
]);
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 {
let mut config_table = ComfyTable::new();
fn build_config_table(settings: &config::Settings) -> Table {
let mut config_table = Table::new();
if std::io::stdout().is_terminal() {
config_table
.load_preset(UTF8_FULL)
@@ -50,8 +51,8 @@ fn build_config_table(settings: &config::Settings) -> ComfyTable {
}
config_table.set_header(vec![
Cell::new("Setting").add_attribute(comfytable::Attribute::Bold),
Cell::new("Value").add_attribute(comfytable::Attribute::Bold),
Cell::new("Setting").add_attribute(comfy_table::Attribute::Bold),
Cell::new("Value").add_attribute(comfy_table::Attribute::Bold),
]);
// Add relevant configuration settings