fix: Resolve multiple ColumnConfig definitions and type mismatches
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -5,16 +5,6 @@ use serde::{Deserialize, Serialize};
|
||||
use log::{debug, error};
|
||||
use crate::args::{Args};
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct ColumnConfig {
|
||||
pub name: String,
|
||||
pub label: String,
|
||||
#[serde(default)]
|
||||
pub align: ColumnAlignment,
|
||||
#[serde(default)]
|
||||
pub max_len: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum ColumnAlignment {
|
||||
@@ -122,6 +112,14 @@ impl<'de> serde::Deserialize<'de> for ColumnConfig {
|
||||
align: ColumnAlignment,
|
||||
#[serde(default)]
|
||||
max_len: Option<String>,
|
||||
#[serde(default)]
|
||||
fg_color: Option<TableColor>,
|
||||
#[serde(default)]
|
||||
bg_color: Option<TableColor>,
|
||||
#[serde(default)]
|
||||
attributes: Vec<TableAttribute>,
|
||||
#[serde(default)]
|
||||
padding: Option<(u16, u16)>,
|
||||
}
|
||||
|
||||
let helper = Helper::deserialize(deserializer)?;
|
||||
@@ -132,6 +130,10 @@ impl<'de> serde::Deserialize<'de> for ColumnConfig {
|
||||
label,
|
||||
align: helper.align,
|
||||
max_len: helper.max_len,
|
||||
fg_color: helper.fg_color,
|
||||
bg_color: helper.bg_color,
|
||||
attributes: helper.attributes,
|
||||
padding: helper.padding,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,10 +177,10 @@ pub fn create_table_with_config(table_config: &crate::config::TableConfig) -> Ta
|
||||
|
||||
// Set content arrangement
|
||||
match table_config.content_arrangement {
|
||||
ContentArrangement::Dynamic => table.set_content_arrangement(ContentArrangement::Dynamic),
|
||||
ContentArrangement::DynamicFullWidth => table.set_content_arrangement(ContentArrangement::DynamicFullWidth),
|
||||
ContentArrangement::Disabled => table.set_content_arrangement(ContentArrangement::Disabled),
|
||||
}
|
||||
crate::config::ContentArrangement::Dynamic => table.set_content_arrangement(comfy_table::ContentArrangement::Dynamic),
|
||||
crate::config::ContentArrangement::DynamicFullWidth => table.set_content_arrangement(comfy_table::ContentArrangement::DynamicFullWidth),
|
||||
crate::config::ContentArrangement::Disabled => table.set_content_arrangement(comfy_table::ContentArrangement::Disabled),
|
||||
};
|
||||
|
||||
// Set style preset
|
||||
match &table_config.style {
|
||||
@@ -199,6 +199,7 @@ pub fn create_table_with_config(table_config: &crate::config::TableConfig) -> Ta
|
||||
table.load_preset(comfy_table::presets::NOTHING);
|
||||
}
|
||||
// Add more presets as needed
|
||||
table
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,8 +208,6 @@ pub fn create_table_with_config(table_config: &crate::config::TableConfig) -> Ta
|
||||
match modifier.as_str() {
|
||||
"UTF8_SOLID_INNER_BORDERS" => table.apply_modifier(comfy_table::modifiers::UTF8_SOLID_INNER_BORDERS),
|
||||
"UTF8_ROUND_CORNERS" => table.apply_modifier(comfy_table::modifiers::UTF8_ROUND_CORNERS),
|
||||
"UTF8_NO_BORDERS" => table.apply_modifier(comfy_table::modifiers::UTF8_NO_BORDERS),
|
||||
"UTF8_NO_LINES" => table.apply_modifier(comfy_table::modifiers::UTF8_NO_LINES),
|
||||
_ => {} // Ignore unknown modifiers
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,11 @@ use crate::services::types::ItemWithMeta;
|
||||
use crate::modes::common::ColumnType;
|
||||
use crate::modes::common::{format_size, OutputFormat};
|
||||
use anyhow::{Result};
|
||||
use comfy_table::{Table, ContentArrangement, Cell, Row, Color, Attribute};
|
||||
use comfy_table::presets::NOTHING;
|
||||
use comfy_table::{Cell, Row, Color, Attribute};
|
||||
use comfy_table::CellAlignment;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json;
|
||||
use serde_yaml;
|
||||
use std::io::{stdout};
|
||||
use std::io::IsTerminal;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct ListItem {
|
||||
|
||||
Reference in New Issue
Block a user