fix: resolve compilation errors by standardizing filter signatures and fixing ownership issues
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
@@ -17,6 +17,7 @@ pub mod shell;
|
||||
pub mod shell_pid;
|
||||
pub mod keep_pid;
|
||||
pub mod env;
|
||||
pub mod text;
|
||||
// pub mod text; // Removed duplicate
|
||||
|
||||
#[cfg(feature = "magic")]
|
||||
@@ -124,8 +125,8 @@ impl BaseMetaPlugin {
|
||||
pub fn initialize_plugin(
|
||||
&mut self,
|
||||
default_outputs: &[&str],
|
||||
options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||
options: &Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||
outputs: &Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||
) {
|
||||
// Set default outputs
|
||||
for output_name in default_outputs {
|
||||
@@ -134,10 +135,14 @@ impl BaseMetaPlugin {
|
||||
|
||||
// Apply provided options and outputs
|
||||
if let Some(opts) = options {
|
||||
self.options.extend(opts);
|
||||
for (key, value) in opts {
|
||||
self.options.insert(key.clone(), value.clone());
|
||||
}
|
||||
}
|
||||
if let Some(outs) = outputs {
|
||||
self.outputs.extend(outs);
|
||||
for (key, value) in outs {
|
||||
self.outputs.insert(key.clone(), value.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -457,42 +462,6 @@ pub fn get_meta_plugin(
|
||||
return constructor(options, outputs);
|
||||
}
|
||||
|
||||
// Fallback for exec plugin which needs special handling
|
||||
if meta_plugin_type == 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::Exec.to_string();
|
||||
let mut split_whitespace = true;
|
||||
|
||||
if let Some(opts) = &options {
|
||||
if let Some(command_value) = opts.get("command")
|
||||
&& let Some(command_str) = command_value.as_str() {
|
||||
let parts: Vec<&str> = command_str.split_whitespace().collect();
|
||||
if !parts.is_empty() {
|
||||
program_name = parts[0].to_string();
|
||||
args = parts[1..].iter().map(|s| s.to_string()).collect();
|
||||
}
|
||||
}
|
||||
// Handle other options if needed
|
||||
if let Some(split_value) = opts.get("split_whitespace")
|
||||
&& let Some(split_bool) = split_value.as_bool() {
|
||||
split_whitespace = split_bool;
|
||||
}
|
||||
if let Some(name_value) = opts.get("name")
|
||||
&& let Some(name_str) = name_value.as_str() {
|
||||
meta_name = name_str.to_string();
|
||||
}
|
||||
}
|
||||
|
||||
return Box::new(MetaPluginExec::new(&program_name,
|
||||
args.iter().map(|s| s.as_str()).collect(),
|
||||
meta_name,
|
||||
split_whitespace,
|
||||
options,
|
||||
outputs));
|
||||
}
|
||||
|
||||
// Fallback for unknown plugins
|
||||
panic!("Meta plugin {:?} not registered", meta_plugin_type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user