feat: update meta plugin constructors to accept options and outputs
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -36,9 +36,25 @@ impl std::fmt::Debug for MetaPluginProgram {
|
||||
}
|
||||
|
||||
impl MetaPluginProgram {
|
||||
pub fn new(program: &str, args: Vec<&str>, meta_name: String, split_whitespace: bool) -> MetaPluginProgram {
|
||||
pub fn new(
|
||||
program: &str,
|
||||
args: Vec<&str>,
|
||||
meta_name: String,
|
||||
split_whitespace: bool,
|
||||
options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||
) -> MetaPluginProgram {
|
||||
let program_path = which(program);
|
||||
let supported = program_path.is_ok();
|
||||
|
||||
// Start with default outputs
|
||||
let mut final_outputs = std::collections::HashMap::new();
|
||||
final_outputs.insert(meta_name.clone(), serde_yaml::Value::String(meta_name.clone()));
|
||||
if let Some(outs) = outputs {
|
||||
for (key, value) in outs {
|
||||
final_outputs.insert(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
MetaPluginProgram {
|
||||
program: program_path.map_or_else(|_| program.to_string(), |p| p.to_string_lossy().to_string()),
|
||||
@@ -50,9 +66,14 @@ impl MetaPluginProgram {
|
||||
writer: None,
|
||||
item_id: None,
|
||||
result: None,
|
||||
outputs: std::collections::HashMap::new(),
|
||||
outputs: final_outputs,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_simple(program: &str, args: Vec<&str>, meta_name: String, split_whitespace: bool) -> MetaPluginProgram {
|
||||
Self::new(program, args, meta_name, split_whitespace, None, None)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MetaPlugin for MetaPluginProgram {
|
||||
|
||||
Reference in New Issue
Block a user