refactor: Enhance table generation and clean up dependencies

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 18:29:50 -03:00
parent b4046e0b18
commit 26a8712d82
5 changed files with 31 additions and 79 deletions

View File

@@ -43,24 +43,14 @@ use crate::modes::common::OutputFormat;
use crate::config;
use serde_json;
use serde_yaml;
use comfy_table::{Table, ContentArrangement, Cell, Color, Attribute};
use comfy_table::presets::UTF8_FULL;
use comfy_table::modifiers::UTF8_ROUND_CORNERS;
use comfy_table::{Cell, Color, Attribute};
use crate::meta_plugin::{MetaPluginType, get_meta_plugin};
use crate::common::status::{MetaPluginInfo, CompressionInfo};
fn build_meta_plugin_table(meta_plugin_info: &std::collections::HashMap<String, MetaPluginInfo>) -> Table {
let mut meta_plugin_table = Table::new();
meta_plugin_table
.load_preset(UTF8_FULL)
.apply_modifier(UTF8_ROUND_CORNERS)
.set_content_arrangement(ContentArrangement::Dynamic);
if !std::io::stdout().is_terminal() {
meta_plugin_table.force_no_tty();
}
let mut meta_plugin_table = crate::modes::common::create_table(true);
meta_plugin_table.set_header(vec![
Cell::new("Plugin Name").add_attribute(Attribute::Bold),
@@ -121,15 +111,7 @@ fn build_meta_plugin_table(meta_plugin_info: &std::collections::HashMap<String,
}
fn build_compression_table(compression_info: &Vec<CompressionInfo>) -> Table {
let mut compression_table = Table::new();
compression_table
.load_preset(UTF8_FULL)
.apply_modifier(UTF8_ROUND_CORNERS)
.set_content_arrangement(ContentArrangement::Dynamic);
if !std::io::stdout().is_terminal() {
compression_table.force_no_tty();
}
let mut compression_table = crate::modes::common::create_table(true);
compression_table.set_header(vec![
Cell::new("Type").add_attribute(Attribute::Bold),
@@ -161,15 +143,7 @@ fn build_compression_table(compression_info: &Vec<CompressionInfo>) -> Table {
}
fn build_filter_plugin_table(filter_plugins: &Vec<crate::common::status::FilterPluginInfo>) -> Table {
let mut filter_plugin_table = Table::new();
filter_plugin_table
.load_preset(UTF8_FULL)
.apply_modifier(UTF8_ROUND_CORNERS)
.set_content_arrangement(ContentArrangement::Dynamic);
if !std::io::stdout().is_terminal() {
filter_plugin_table.force_no_tty();
}
let mut filter_plugin_table = crate::modes::common::create_table(true);
filter_plugin_table.set_header(vec![
Cell::new("Plugin Name").add_attribute(Attribute::Bold),