refactor: use MetaPlugin.is_supported() to determine plugin status display

Co-authored-by: aider (openai/andrew.openrouter.qwen.qwen3-coder) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-07-29 13:53:11 -03:00
parent 93046a220e
commit 9615e684f0

View File

@@ -133,19 +133,20 @@ fn build_meta_plugin_table(enabled_meta_plugins: &Vec<MetaPluginType>) -> Table
let is_enabled = enabled_meta_plugins.contains(&meta_plugin_type);
// Determine what implementation will actually be used
let (binary_display, args_display) = match meta_plugin_type {
// For internal plugins, always show as internal
MetaPluginType::DigestSha256 | MetaPluginType::ReadTime | MetaPluginType::ReadRate |
MetaPluginType::Cwd | MetaPluginType::Uid | MetaPluginType::User |
MetaPluginType::Gid | MetaPluginType::Group | MetaPluginType::Shell |
MetaPluginType::ShellPid | MetaPluginType::KeepPid | MetaPluginType::Hostname |
MetaPluginType::FullHostname => {
("<INTERNAL>".to_string(), "".to_string())
},
// For program-based plugins, show program info if supported, otherwise show as not found
_ => {
// For program-based plugins, we need to check if they're supported
if is_supported {
let (binary_display, args_display) = if !is_supported {
("<NOT FOUND>".to_string(), "".to_string())
} else {
match meta_plugin_type {
// For internal plugins, always show as internal
MetaPluginType::DigestSha256 | MetaPluginType::ReadTime | MetaPluginType::ReadRate |
MetaPluginType::Cwd | MetaPluginType::Uid | MetaPluginType::User |
MetaPluginType::Gid | MetaPluginType::Group | MetaPluginType::Shell |
MetaPluginType::ShellPid | MetaPluginType::KeepPid | MetaPluginType::Hostname |
MetaPluginType::FullHostname => {
("<INTERNAL>".to_string(), "".to_string())
},
// For program-based plugins, show program info
_ => {
// Get the program info by downcasting to MetaPluginProgram
// This is a bit hacky but necessary to get the program info
let program_name = match meta_plugin_type {
@@ -169,8 +170,6 @@ fn build_meta_plugin_table(enabled_meta_plugins: &Vec<MetaPluginType>) -> Table
};
(program_name, args.to_string())
} else {
("<NOT FOUND>".to_string(), "".to_string())
}
}
};
@@ -187,6 +186,7 @@ fn build_meta_plugin_table(enabled_meta_plugins: &Vec<MetaPluginType>) -> Table
},
match binary_display.as_str() {
"<INTERNAL>" => Cell::new(&binary_display).with_style(Attr::ForegroundColor(color::BRIGHT_BLACK)),
"<NOT FOUND>" => Cell::new(&binary_display).with_style(Attr::ForegroundColor(color::RED)),
_ => Cell::new(&binary_display),
},
Cell::new(&args_display),