feat: add support for meta plugin options and outputs
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -11,6 +11,7 @@ pub struct DigestSha256MetaPlugin {
|
||||
meta_name: String,
|
||||
item_id: Option<i64>,
|
||||
conn: Option<*mut Connection>,
|
||||
output_name: Option<String>,
|
||||
}
|
||||
|
||||
impl DigestSha256MetaPlugin {
|
||||
@@ -20,6 +21,7 @@ impl DigestSha256MetaPlugin {
|
||||
meta_name: "digest_sha256".to_string(),
|
||||
item_id: None,
|
||||
conn: None,
|
||||
output_name: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,7 +50,7 @@ impl MetaPlugin for DigestSha256MetaPlugin {
|
||||
// Save the hash as metadata
|
||||
let meta = crate::db::Meta {
|
||||
id: item_id,
|
||||
name: self.meta_name.clone(),
|
||||
name: self.get_output_name(&self.meta_name),
|
||||
value: hex_string,
|
||||
};
|
||||
crate::db::store_meta(conn_ref, meta)?;
|
||||
@@ -63,6 +65,25 @@ impl MetaPlugin for DigestSha256MetaPlugin {
|
||||
fn meta_name(&mut self) -> String {
|
||||
self.meta_name.clone()
|
||||
}
|
||||
|
||||
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
||||
if let Some(outputs) = options.get("outputs") {
|
||||
if let Some(outputs_map) = outputs.as_mapping() {
|
||||
for (key, value) in outputs_map {
|
||||
if let (Some(key_str), Some(value_str)) = (key.as_str(), value.as_str()) {
|
||||
if key_str == "digest_sha256" {
|
||||
self.output_name = Some(value_str.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_output_name(&self, default_name: &str) -> String {
|
||||
self.output_name.clone().unwrap_or_else(|| default_name.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user