feat: add default_options method to all meta plugins
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -110,6 +110,12 @@ pub trait MetaPlugin {
|
|||||||
Vec::new()
|
Vec::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the default options for this plugin
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
// Default implementation returns empty - plugins should override this
|
||||||
|
std::collections::HashMap::new()
|
||||||
|
}
|
||||||
|
|
||||||
// Save metadata to database using central output handler
|
// Save metadata to database using central output handler
|
||||||
fn save_meta(&mut self, conn: &Connection, item_id: i64, internal_name: &str, value: String) -> Result<()> {
|
fn save_meta(&mut self, conn: &Connection, item_id: i64, internal_name: &str, value: String) -> Result<()> {
|
||||||
output_metadata(conn, item_id, internal_name, value, self.outputs())
|
output_metadata(conn, item_id, internal_name, value, self.outputs())
|
||||||
|
|||||||
@@ -103,4 +103,10 @@ impl MetaPlugin for BinaryMetaPlugin {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec!["binary".to_string()]
|
vec!["binary".to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
let mut options = std::collections::HashMap::new();
|
||||||
|
options.insert("max_buffer_size".to_string(), serde_yaml::Value::Number(4096.into()));
|
||||||
|
options
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,10 @@ impl MetaPlugin for DigestSha256MetaPlugin {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec!["digest_sha256".to_string()]
|
vec!["digest_sha256".to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
std::collections::HashMap::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -115,6 +119,10 @@ impl MetaPlugin for ReadTimeMetaPlugin {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec!["read_time".to_string()]
|
vec!["read_time".to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
std::collections::HashMap::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
@@ -167,4 +175,8 @@ impl MetaPlugin for ReadRateMetaPlugin {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec!["read_rate".to_string()]
|
vec!["read_rate".to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
std::collections::HashMap::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,5 +149,11 @@ impl MetaPlugin for MagicFileMetaPlugin {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec!["mime_type".to_string(), "mime_encoding".to_string(), "file_type".to_string()]
|
vec!["mime_type".to_string(), "mime_encoding".to_string(), "file_type".to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
let mut options = std::collections::HashMap::new();
|
||||||
|
options.insert("max_buffer_size".to_string(), serde_yaml::Value::Number(4096.into()));
|
||||||
|
options
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -163,4 +163,8 @@ impl MetaPlugin for MetaPluginProgram {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec![self.meta_name.clone()]
|
vec![self.meta_name.clone()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
std::collections::HashMap::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ impl MetaPlugin for CwdMetaPlugin {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec!["cwd".to_string()]
|
vec!["cwd".to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
std::collections::HashMap::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
@@ -121,6 +125,10 @@ impl MetaPlugin for UidMetaPlugin {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec!["uid".to_string()]
|
vec!["uid".to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
std::collections::HashMap::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
@@ -179,6 +187,10 @@ impl MetaPlugin for UserMetaPlugin {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec!["user".to_string()]
|
vec!["user".to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
std::collections::HashMap::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
@@ -234,6 +246,10 @@ impl MetaPlugin for GidMetaPlugin {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec!["gid".to_string()]
|
vec!["gid".to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
std::collections::HashMap::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
@@ -292,6 +308,10 @@ impl MetaPlugin for GroupMetaPlugin {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec!["group".to_string()]
|
vec!["group".to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
std::collections::HashMap::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
@@ -350,6 +370,10 @@ impl MetaPlugin for ShellMetaPlugin {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec!["shell".to_string()]
|
vec!["shell".to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
std::collections::HashMap::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
@@ -408,6 +432,10 @@ impl MetaPlugin for ShellPidMetaPlugin {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec!["shell_pid".to_string()]
|
vec!["shell_pid".to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
std::collections::HashMap::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
@@ -463,6 +491,10 @@ impl MetaPlugin for KeepPidMetaPlugin {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec!["keep_pid".to_string()]
|
vec!["keep_pid".to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
std::collections::HashMap::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
@@ -521,6 +553,10 @@ impl MetaPlugin for HostnameMetaPlugin {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec!["hostname".to_string()]
|
vec!["hostname".to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
std::collections::HashMap::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
@@ -597,4 +633,8 @@ impl MetaPlugin for FullHostnameMetaPlugin {
|
|||||||
fn default_outputs(&self) -> Vec<String> {
|
fn default_outputs(&self) -> Vec<String> {
|
||||||
vec!["full_hostname".to_string()]
|
vec!["full_hostname".to_string()]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_options(&self) -> std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
std::collections::HashMap::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user