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