refactor: use is_internal function to determine plugin type instead of hardcoded list

Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-11 12:15:51 -03:00
parent f5149cfb68
commit e2bcdd2acf
2 changed files with 22 additions and 45 deletions

View File

@@ -274,20 +274,13 @@ async fn handle_status(
let (binary_display, args_display) = if !is_supported { let (binary_display, args_display) = if !is_supported {
("<NOT FOUND>".to_string(), "".to_string()) ("<NOT FOUND>".to_string(), "".to_string())
} else { } else {
match meta_plugin_type { if meta_plugin.is_internal() {
MetaPluginType::DigestSha256 | MetaPluginType::ReadTime | MetaPluginType::ReadRate | ("<INTERNAL>".to_string(), "".to_string())
MetaPluginType::Cwd | MetaPluginType::Uid | MetaPluginType::User | } else {
MetaPluginType::Gid | MetaPluginType::Group | MetaPluginType::Shell | if let Some((program, args)) = meta_plugin.program_info() {
MetaPluginType::ShellPid | MetaPluginType::KeepPid | MetaPluginType::Hostname | (program.to_string(), args.join(" "))
MetaPluginType::FullHostname => { } else {
("<INTERNAL>".to_string(), "".to_string()) ("<NOT FOUND>".to_string(), "".to_string())
},
_ => {
if let Some((program, args)) = meta_plugin.program_info() {
(program.to_string(), args.join(" "))
} else {
("<NOT FOUND>".to_string(), "".to_string())
}
} }
} }
}; };

View File

@@ -145,23 +145,14 @@ fn build_meta_plugin_table(enabled_meta_plugins: &Vec<MetaPluginType>) -> Table
let (binary_display, args_display) = if !is_supported { let (binary_display, args_display) = if !is_supported {
("<NOT FOUND>".to_string(), "".to_string()) ("<NOT FOUND>".to_string(), "".to_string())
} else { } else {
match meta_plugin_type { if meta_plugin.is_internal() {
// For internal plugins, always show as internal ("<INTERNAL>".to_string(), "".to_string())
MetaPluginType::DigestSha256 | MetaPluginType::ReadTime | MetaPluginType::ReadRate | } else {
MetaPluginType::Cwd | MetaPluginType::Uid | MetaPluginType::User | // Get program info from the meta plugin itself
MetaPluginType::Gid | MetaPluginType::Group | MetaPluginType::Shell | if let Some((program, args)) = meta_plugin.program_info() {
MetaPluginType::ShellPid | MetaPluginType::KeepPid | MetaPluginType::Hostname | (program.to_string(), args.join(" "))
MetaPluginType::FullHostname => { } else {
("<INTERNAL>".to_string(), "".to_string()) ("<NOT FOUND>".to_string(), "".to_string())
},
// For program-based plugins, show program info
_ => {
// Get program info from the meta plugin itself
if let Some((program, args)) = meta_plugin.program_info() {
(program.to_string(), args.join(" "))
} else {
("<NOT FOUND>".to_string(), "".to_string())
}
} }
} }
}; };
@@ -248,20 +239,13 @@ fn show_status_structured(
let (binary_display, args_display) = if !is_supported { let (binary_display, args_display) = if !is_supported {
("<NOT FOUND>".to_string(), "".to_string()) ("<NOT FOUND>".to_string(), "".to_string())
} else { } else {
match meta_plugin_type { if meta_plugin.is_internal() {
MetaPluginType::DigestSha256 | MetaPluginType::ReadTime | MetaPluginType::ReadRate | ("<INTERNAL>".to_string(), "".to_string())
MetaPluginType::Cwd | MetaPluginType::Uid | MetaPluginType::User | } else {
MetaPluginType::Gid | MetaPluginType::Group | MetaPluginType::Shell | if let Some((program, args)) = meta_plugin.program_info() {
MetaPluginType::ShellPid | MetaPluginType::KeepPid | MetaPluginType::Hostname | (program.to_string(), args.join(" "))
MetaPluginType::FullHostname => { } else {
("<INTERNAL>".to_string(), "".to_string()) ("<NOT FOUND>".to_string(), "".to_string())
},
_ => {
if let Some((program, args)) = meta_plugin.program_info() {
(program.to_string(), args.join(" "))
} else {
("<NOT FOUND>".to_string(), "".to_string())
}
} }
} }
}; };