feat: update meta plugin table to show options and sorted output keys
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -277,32 +277,50 @@ fn build_meta_plugin_table(meta_plugin_info: &Vec<MetaPluginInfo>) -> Table {
|
||||
|
||||
meta_plugin_table.set_titles(row!(
|
||||
b->"Meta Name",
|
||||
b->"Found",
|
||||
b->"Binary",
|
||||
b->"Args",
|
||||
b->"Options",
|
||||
b->"Outputs"));
|
||||
|
||||
for info in meta_plugin_info {
|
||||
// Extract just the keys from the outputs
|
||||
let outputs_keys: Vec<&str> = info.outputs.keys().map(|s| s.as_str()).collect();
|
||||
let outputs_display = if outputs_keys.is_empty() {
|
||||
"".to_string()
|
||||
// Get default options for the meta plugin
|
||||
let meta_plugin_type = match MetaPluginType::from_str(&info.meta_name) {
|
||||
Ok(plugin_type) => plugin_type,
|
||||
Err(_) => continue,
|
||||
};
|
||||
|
||||
// Create a default plugin to get its default options
|
||||
let default_plugin = get_meta_plugin(
|
||||
meta_plugin_type.clone(),
|
||||
None,
|
||||
None,
|
||||
);
|
||||
|
||||
// Get and sort options
|
||||
let mut options: Vec<_> = default_plugin.options().iter().collect();
|
||||
options.sort_by(|a, b| a.0.cmp(b.0));
|
||||
|
||||
// Format options as YAML string, each on a new line
|
||||
let options_str = if options.is_empty() {
|
||||
"{}".to_string()
|
||||
} else {
|
||||
outputs_keys.join(", ")
|
||||
let options_map: std::collections::BTreeMap<_, _> = options.into_iter().collect();
|
||||
serde_yaml::to_string(&options_map)
|
||||
.unwrap_or_else(|_| "Unable to serialize options".to_string())
|
||||
.trim()
|
||||
.to_string()
|
||||
};
|
||||
|
||||
// Get and sort output keys
|
||||
let mut output_keys: Vec<&String> = info.outputs.keys().collect();
|
||||
output_keys.sort();
|
||||
let outputs_display = if output_keys.is_empty() {
|
||||
"{}".to_string()
|
||||
} else {
|
||||
output_keys.join("\n")
|
||||
};
|
||||
|
||||
meta_plugin_table.add_row(Row::new(vec![
|
||||
Cell::new(&info.meta_name),
|
||||
match info.found {
|
||||
true => Cell::new("Yes").with_style(Attr::ForegroundColor(color::GREEN)),
|
||||
false => Cell::new("No").with_style(Attr::ForegroundColor(color::RED)),
|
||||
},
|
||||
match info.binary.as_str() {
|
||||
"<INTERNAL>" => Cell::new(&info.binary).with_style(Attr::ForegroundColor(color::BRIGHT_BLACK)),
|
||||
"<NOT FOUND>" => Cell::new(&info.binary).with_style(Attr::ForegroundColor(color::RED)),
|
||||
_ => Cell::new(&info.binary),
|
||||
},
|
||||
Cell::new(&info.args),
|
||||
Cell::new(&options_str),
|
||||
Cell::new(&outputs_display),
|
||||
]));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user