fix: use configured labels for meta columns in list display
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -112,27 +112,6 @@ impl Settings {
|
|||||||
config_builder = config_builder.set_override("dir", dir.to_str().unwrap())?;
|
config_builder = config_builder.set_override("dir", dir.to_str().unwrap())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only override list_format if it was explicitly provided via CLI args
|
|
||||||
// (not equal to the default value)
|
|
||||||
if args.options.list_format != "id,time,size,tags,meta:hostname" {
|
|
||||||
// Convert the string format to the new list format structure
|
|
||||||
let columns: Vec<std::collections::HashMap<String, String>> = args.options.list_format
|
|
||||||
.split(',')
|
|
||||||
.map(|col| {
|
|
||||||
let parts: Vec<&str> = col.split(':').collect();
|
|
||||||
let mut map = std::collections::HashMap::new();
|
|
||||||
map.insert("name".to_string(), col.to_string()); // Use full column spec as name
|
|
||||||
let label = if parts.len() > 1 {
|
|
||||||
parts[1].to_string()
|
|
||||||
} else {
|
|
||||||
parts[0].to_string()
|
|
||||||
};
|
|
||||||
map.insert("label".to_string(), label);
|
|
||||||
map
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
config_builder = config_builder.set_override("list_format", columns)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
if args.options.human_readable {
|
if args.options.human_readable {
|
||||||
config_builder = config_builder.set_override("human_readable", true)?;
|
config_builder = config_builder.set_override("human_readable", true)?;
|
||||||
|
|||||||
@@ -90,16 +90,7 @@ pub fn mode_list(
|
|||||||
let column_type = ColumnType::from_str(&column.name)
|
let column_type = ColumnType::from_str(&column.name)
|
||||||
.map_err(|_| anyhow!("Unknown column {:?}", column.name))?;
|
.map_err(|_| anyhow!("Unknown column {:?}", column.name))?;
|
||||||
|
|
||||||
if column_type == ColumnType::Meta {
|
title_row.add_cell(Cell::new(&column.label).with_style(Attr::Bold));
|
||||||
let parts: Vec<&str> = column.name.split(':').collect();
|
|
||||||
if parts.len() > 1 {
|
|
||||||
title_row.add_cell(Cell::new(parts[1]).with_style(Attr::Bold));
|
|
||||||
} else {
|
|
||||||
title_row.add_cell(Cell::new(&column.label).with_style(Attr::Bold));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
title_row.add_cell(Cell::new(&column.label).with_style(Attr::Bold));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
table.set_titles(title_row);
|
table.set_titles(title_row);
|
||||||
|
|||||||
Reference in New Issue
Block a user