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,22 +274,15 @@ 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 |
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()) ("<INTERNAL>".to_string(), "".to_string())
}, } else {
_ => {
if let Some((program, args)) = meta_plugin.program_info() { if let Some((program, args)) = meta_plugin.program_info() {
(program.to_string(), args.join(" ")) (program.to_string(), args.join(" "))
} else { } else {
("<NOT FOUND>".to_string(), "".to_string()) ("<NOT FOUND>".to_string(), "".to_string())
} }
} }
}
}; };
meta_plugin_info.push(MetaPluginInfo { meta_plugin_info.push(MetaPluginInfo {

View File

@@ -145,17 +145,9 @@ 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
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()) ("<INTERNAL>".to_string(), "".to_string())
}, } else {
// For program-based plugins, show program info
_ => {
// Get program info from the meta plugin itself // Get program info from the meta plugin itself
if let Some((program, args)) = meta_plugin.program_info() { if let Some((program, args)) = meta_plugin.program_info() {
(program.to_string(), args.join(" ")) (program.to_string(), args.join(" "))
@@ -163,7 +155,6 @@ fn build_meta_plugin_table(enabled_meta_plugins: &Vec<MetaPluginType>) -> Table
("<NOT FOUND>".to_string(), "".to_string()) ("<NOT FOUND>".to_string(), "".to_string())
} }
} }
}
}; };
meta_plugin_table.add_row(Row::new(vec![ meta_plugin_table.add_row(Row::new(vec![
@@ -248,22 +239,15 @@ 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 |
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()) ("<INTERNAL>".to_string(), "".to_string())
}, } else {
_ => {
if let Some((program, args)) = meta_plugin.program_info() { if let Some((program, args)) = meta_plugin.program_info() {
(program.to_string(), args.join(" ")) (program.to_string(), args.join(" "))
} else { } else {
("<NOT FOUND>".to_string(), "".to_string()) ("<NOT FOUND>".to_string(), "".to_string())
} }
} }
}
}; };
meta_plugin_info.push(MetaPluginInfo { meta_plugin_info.push(MetaPluginInfo {