feat: add max_len support to ColumnConfig and default list format
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -11,6 +11,8 @@ pub struct ColumnConfig {
|
||||
pub label: String,
|
||||
#[serde(default)]
|
||||
pub align: ColumnAlignment,
|
||||
#[serde(default)]
|
||||
pub max_len: Option<usize>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
@@ -32,6 +34,8 @@ impl<'de> serde::Deserialize<'de> for ColumnConfig {
|
||||
label: Option<String>,
|
||||
#[serde(default)]
|
||||
align: ColumnAlignment,
|
||||
#[serde(default)]
|
||||
max_len: Option<usize>,
|
||||
}
|
||||
|
||||
let helper = Helper::deserialize(deserializer)?;
|
||||
@@ -41,6 +45,7 @@ impl<'de> serde::Deserialize<'de> for ColumnConfig {
|
||||
name: helper.name,
|
||||
label,
|
||||
align: helper.align,
|
||||
max_len: helper.max_len,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -198,11 +203,36 @@ impl Settings {
|
||||
if settings.list_format.is_empty() {
|
||||
debug!("CONFIG: Setting default list_format");
|
||||
settings.list_format = vec![
|
||||
ColumnConfig { name: "id".to_string(), label: "id".to_string(), align: ColumnAlignment::Left },
|
||||
ColumnConfig { name: "time".to_string(), label: "time".to_string(), align: ColumnAlignment::Left },
|
||||
ColumnConfig { name: "size".to_string(), label: "size".to_string(), align: ColumnAlignment::Left },
|
||||
ColumnConfig { name: "tags".to_string(), label: "tags".to_string(), align: ColumnAlignment::Left },
|
||||
ColumnConfig { name: "meta:hostname".to_string(), label: "hostname".to_string(), align: ColumnAlignment::Left },
|
||||
ColumnConfig {
|
||||
name: "id".to_string(),
|
||||
label: "id".to_string(),
|
||||
align: ColumnAlignment::Left,
|
||||
max_len: Some(8),
|
||||
},
|
||||
ColumnConfig {
|
||||
name: "time".to_string(),
|
||||
label: "time".to_string(),
|
||||
align: ColumnAlignment::Left,
|
||||
max_len: Some(19),
|
||||
},
|
||||
ColumnConfig {
|
||||
name: "size".to_string(),
|
||||
label: "size".to_string(),
|
||||
align: ColumnAlignment::Left,
|
||||
max_len: Some(10),
|
||||
},
|
||||
ColumnConfig {
|
||||
name: "tags".to_string(),
|
||||
label: "tags".to_string(),
|
||||
align: ColumnAlignment::Left,
|
||||
max_len: Some(20),
|
||||
},
|
||||
ColumnConfig {
|
||||
name: "meta:hostname".to_string(),
|
||||
label: "hostname".to_string(),
|
||||
align: ColumnAlignment::Left,
|
||||
max_len: Some(15),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user