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

@@ -9,24 +9,14 @@ use crate::config;
use crate::common::status::StatusInfo;
use serde_json;
use serde_yaml;
use comfy_table::{Table, ContentArrangement, Cell, Attribute};
use comfy_table::presets::UTF8_FULL;
use comfy_table::modifiers::UTF8_ROUND_CORNERS;
use comfy_table::{Cell, Attribute};
use crate::common::status::PathInfo;
use crate::meta_plugin::MetaPluginType;
use crate::meta_plugin::get_meta_plugin;
fn build_path_table(path_info: &PathInfo) -> Table {
let mut path_table = Table::new();
path_table
.load_preset(UTF8_FULL)
.apply_modifier(UTF8_ROUND_CORNERS)
.set_content_arrangement(ContentArrangement::Dynamic);
if !std::io::stdout().is_terminal() {
path_table.force_no_tty();
}
let mut path_table = crate::modes::common::create_table(true);
path_table.set_header(vec![
Cell::new("Type").add_attribute(Attribute::Bold),
@@ -41,15 +31,7 @@ fn build_path_table(path_info: &PathInfo) -> Table {
fn build_config_table(settings: &config::Settings) -> Table {
let mut config_table = Table::new();
config_table
.load_preset(UTF8_FULL)
.apply_modifier(UTF8_ROUND_CORNERS)
.set_content_arrangement(ContentArrangement::Dynamic);
if !std::io::stdout().is_terminal() {
config_table.force_no_tty();
}
let mut config_table = crate::modes::common::create_table(true);
config_table.set_header(vec![
Cell::new("Setting").add_attribute(Attribute::Bold),
@@ -82,15 +64,7 @@ fn build_meta_plugins_configured_table(status_info: &StatusInfo) -> Option<Table
let mut sorted_meta_plugins = meta_plugins.clone();
sorted_meta_plugins.sort_by(|a, b| a.name.cmp(&b.name));
let mut table = Table::new();
table
.load_preset(UTF8_FULL)
.apply_modifier(UTF8_ROUND_CORNERS)
.set_content_arrangement(ContentArrangement::Dynamic);
if !std::io::stdout().is_terminal() {
table.force_no_tty();
}
let mut table = crate::modes::common::create_table(true);
table.set_header(vec![
Cell::new("Plugin Name").add_attribute(Attribute::Bold),