feat: add options to meta plugins
Co-authored-by: aider (openai/andrew/openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
This commit is contained in:
@@ -18,6 +18,7 @@ pub struct MetaPluginProgram {
|
||||
item_id: Option<i64>,
|
||||
result: Option<String>,
|
||||
outputs: std::collections::HashMap<String, serde_yaml::Value>,
|
||||
options: std::collections::HashMap<String, serde_yaml::Value>,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for MetaPluginProgram {
|
||||
@@ -31,6 +32,7 @@ impl std::fmt::Debug for MetaPluginProgram {
|
||||
.field("process", &self.process)
|
||||
.field("writer", &"Box<dyn Write>")
|
||||
.field("outputs", &self.outputs)
|
||||
.field("options", &self.options)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
@@ -56,6 +58,14 @@ impl MetaPluginProgram {
|
||||
}
|
||||
}
|
||||
|
||||
// Start with default options
|
||||
let mut final_options = std::collections::HashMap::new();
|
||||
if let Some(opts) = _options {
|
||||
for (key, value) in opts {
|
||||
final_options.insert(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
MetaPluginProgram {
|
||||
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(),
|
||||
@@ -67,6 +77,7 @@ impl MetaPluginProgram {
|
||||
item_id: None,
|
||||
result: None,
|
||||
outputs: final_outputs,
|
||||
options: final_options,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,4 +198,12 @@ impl MetaPlugin for MetaPluginProgram {
|
||||
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||
std::collections::HashMap::new()
|
||||
}
|
||||
|
||||
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||
&self.options
|
||||
}
|
||||
|
||||
fn options_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||
&mut self.options
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user