From 15baa8f29772a55f2416dd093be9fa72250877e3 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Wed, 27 Aug 2025 22:01:47 -0300 Subject: [PATCH] refactor: rename command plugin to exec Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) --- src/meta_plugin/command.rs | 16 ++++++++-------- src/meta_plugin/mod.rs | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/meta_plugin/command.rs b/src/meta_plugin/command.rs index bcad0fd..01228bf 100644 --- a/src/meta_plugin/command.rs +++ b/src/meta_plugin/command.rs @@ -5,7 +5,7 @@ use which::which; use crate::meta_plugin::{MetaPlugin, MetaPluginResponse, MetaPluginType}; -pub struct MetaPluginCommand { +pub struct MetaPluginExec { pub program: String, pub args: Vec, pub supported: bool, @@ -18,9 +18,9 @@ pub struct MetaPluginCommand { } // Manual Debug implementation because Box doesn't implement Debug -impl std::fmt::Debug for MetaPluginCommand { +impl std::fmt::Debug for MetaPluginExec { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("MetaPluginCommand") + f.debug_struct("MetaPluginExec") .field("program", &self.program) .field("args", &self.args) .field("supported", &self.supported) @@ -35,7 +35,7 @@ impl std::fmt::Debug for MetaPluginCommand { } -impl MetaPluginCommand { +impl MetaPluginExec { pub fn new( program: &str, args: Vec<&str>, @@ -43,7 +43,7 @@ impl MetaPluginCommand { split_whitespace: bool, _options: Option>, outputs: Option>, - ) -> MetaPluginCommand { + ) -> MetaPluginExec { let program_path = which(program); let supported = program_path.is_ok(); @@ -64,7 +64,7 @@ impl MetaPluginCommand { } } - MetaPluginCommand { + MetaPluginExec { program: program_path.map_or_else(|_| program.to_string(), |p| p.to_string_lossy().to_string()), args: args.iter().map(|s| s.to_string()).collect(), supported, @@ -79,7 +79,7 @@ impl MetaPluginCommand { } -impl MetaPlugin for MetaPluginCommand { +impl MetaPlugin for MetaPluginExec { fn is_supported(&self) -> bool { self.supported } @@ -193,7 +193,7 @@ impl MetaPlugin for MetaPluginCommand { } fn meta_type(&self) -> MetaPluginType { - MetaPluginType::Command + MetaPluginType::Exec } fn program_info(&self) -> Option<(&str, Vec<&str>)> { diff --git a/src/meta_plugin/mod.rs b/src/meta_plugin/mod.rs index 7d40134..db7296c 100644 --- a/src/meta_plugin/mod.rs +++ b/src/meta_plugin/mod.rs @@ -1,7 +1,7 @@ use log::debug; use serde::{Deserialize, Serialize}; -pub mod command; +pub mod exec; pub mod digest; pub mod magic; pub mod binary; @@ -15,7 +15,7 @@ pub mod shell; pub mod shell_pid; pub mod keep_pid; -use crate::meta_plugin::command::MetaPluginCommand; +use crate::meta_plugin::exec::MetaPluginExec; use crate::meta_plugin::digest::DigestMetaPlugin; use crate::meta_plugin::read_time::ReadTimeMetaPlugin; use crate::meta_plugin::read_rate::ReadRateMetaPlugin; @@ -133,7 +133,7 @@ pub enum MetaPluginType { ReadTime, ReadRate, Hostname, - Command, + Exec, } /// Central function to handle metadata output with name mapping @@ -291,11 +291,11 @@ pub fn get_meta_plugin( MetaPluginType::ReadTime => Box::new(ReadTimeMetaPlugin::new(options, outputs)), MetaPluginType::ReadRate => Box::new(ReadRateMetaPlugin::new(options, outputs)), MetaPluginType::Hostname => Box::new(HostnameMetaPlugin::new(options, outputs)), - MetaPluginType::Command => { - // For command type, we need to parse the command from options + MetaPluginType::Exec => { + // For exec type, we need to parse the command from options let mut program_name = String::new(); let mut args = Vec::new(); - let mut meta_name = MetaPluginType::Command.to_string(); + let mut meta_name = MetaPluginType::Exec.to_string(); let mut split_whitespace = true; if let Some(opts) = &options { @@ -321,12 +321,12 @@ pub fn get_meta_plugin( } } - Box::new(MetaPluginCommand::new(&program_name, - args.iter().map(|s| s.as_str()).collect(), - meta_name, - split_whitespace, - options, - outputs)) + Box::new(MetaPluginExec::new(&program_name, + args.iter().map(|s| s.as_str()).collect(), + meta_name, + split_whitespace, + options, + outputs)) } } }