refactor: rename command plugin to exec
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -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<String>,
|
||||
pub supported: bool,
|
||||
@@ -18,9 +18,9 @@ pub struct MetaPluginCommand {
|
||||
}
|
||||
|
||||
// Manual Debug implementation because Box<dyn Write> 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<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||
) -> 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>)> {
|
||||
|
||||
Reference in New Issue
Block a user