From 9615e684f01d3da4c1a863a8fb5a89dd4b4bdb40 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Tue, 29 Jul 2025 13:53:11 -0300 Subject: [PATCH] refactor: use MetaPlugin.is_supported() to determine plugin status display Co-authored-by: aider (openai/andrew.openrouter.qwen.qwen3-coder) --- src/modes/status.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/modes/status.rs b/src/modes/status.rs index 92bc153..6f3f43e 100644 --- a/src/modes/status.rs +++ b/src/modes/status.rs @@ -133,19 +133,20 @@ fn build_meta_plugin_table(enabled_meta_plugins: &Vec) -> 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 => { - ("".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 { + ("".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 => { + ("".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) -> Table }; (program_name, args.to_string()) - } else { - ("".to_string(), "".to_string()) } } }; @@ -187,6 +186,7 @@ fn build_meta_plugin_table(enabled_meta_plugins: &Vec) -> Table }, match binary_display.as_str() { "" => Cell::new(&binary_display).with_style(Attr::ForegroundColor(color::BRIGHT_BLACK)), + "" => Cell::new(&binary_display).with_style(Attr::ForegroundColor(color::RED)), _ => Cell::new(&binary_display), }, Cell::new(&args_display),