refactor: standardize meta plugin structure with base field
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -291,8 +291,7 @@ impl MetaPlugin for UserMetaPlugin {
|
||||
pub struct GidMetaPlugin {
|
||||
meta_name: String,
|
||||
is_saved: bool,
|
||||
outputs: std::collections::HashMap<String, serde_yaml::Value>,
|
||||
options: std::collections::HashMap<String, serde_yaml::Value>,
|
||||
base: crate::meta_plugin::BaseMetaPlugin,
|
||||
}
|
||||
|
||||
impl GidMetaPlugin {
|
||||
@@ -310,7 +309,7 @@ impl GidMetaPlugin {
|
||||
|
||||
// Start with default outputs
|
||||
let mut final_outputs = std::collections::HashMap::new();
|
||||
let default_outputs = Self::default().default_outputs();
|
||||
let default_outputs = vec!["gid".to_string()];
|
||||
for output_name in default_outputs {
|
||||
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||
}
|
||||
@@ -320,11 +319,14 @@ impl GidMetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
let mut base = crate::meta_plugin::BaseMetaPlugin::new();
|
||||
base.outputs = final_outputs;
|
||||
base.options = final_options;
|
||||
|
||||
GidMetaPlugin {
|
||||
meta_name: "gid".to_string(),
|
||||
is_saved: false,
|
||||
outputs: final_outputs,
|
||||
options: final_options,
|
||||
base,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,11 +358,11 @@ impl MetaPlugin for GidMetaPlugin {
|
||||
}
|
||||
|
||||
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||
&self.outputs
|
||||
self.base.outputs()
|
||||
}
|
||||
|
||||
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||
&mut self.outputs
|
||||
self.base.outputs_mut()
|
||||
}
|
||||
|
||||
fn default_outputs(&self) -> Vec<String> {
|
||||
@@ -372,15 +374,11 @@ impl MetaPlugin for GidMetaPlugin {
|
||||
}
|
||||
|
||||
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||
&self.options
|
||||
self.base.options()
|
||||
}
|
||||
|
||||
fn options_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||
&mut self.options
|
||||
}
|
||||
|
||||
fn options_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||
&mut self.options
|
||||
self.base.options_mut()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,8 +386,7 @@ impl MetaPlugin for GidMetaPlugin {
|
||||
pub struct GroupMetaPlugin {
|
||||
meta_name: String,
|
||||
is_saved: bool,
|
||||
outputs: std::collections::HashMap<String, serde_yaml::Value>,
|
||||
options: std::collections::HashMap<String, serde_yaml::Value>,
|
||||
base: crate::meta_plugin::BaseMetaPlugin,
|
||||
}
|
||||
|
||||
impl GroupMetaPlugin {
|
||||
@@ -407,7 +404,7 @@ impl GroupMetaPlugin {
|
||||
|
||||
// Start with default outputs
|
||||
let mut final_outputs = std::collections::HashMap::new();
|
||||
let default_outputs = Self::default().default_outputs();
|
||||
let default_outputs = vec!["group".to_string()];
|
||||
for output_name in default_outputs {
|
||||
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||
}
|
||||
@@ -417,11 +414,14 @@ impl GroupMetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
let mut base = crate::meta_plugin::BaseMetaPlugin::new();
|
||||
base.outputs = final_outputs;
|
||||
base.options = final_options;
|
||||
|
||||
GroupMetaPlugin {
|
||||
meta_name: "group".to_string(),
|
||||
is_saved: false,
|
||||
outputs: final_outputs,
|
||||
options: final_options,
|
||||
base,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,11 +456,11 @@ impl MetaPlugin for GroupMetaPlugin {
|
||||
}
|
||||
|
||||
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||
&self.outputs
|
||||
self.base.outputs()
|
||||
}
|
||||
|
||||
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||
&mut self.outputs
|
||||
self.base.outputs_mut()
|
||||
}
|
||||
|
||||
fn default_outputs(&self) -> Vec<String> {
|
||||
@@ -472,11 +472,11 @@ impl MetaPlugin for GroupMetaPlugin {
|
||||
}
|
||||
|
||||
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||
&self.options
|
||||
self.base.options()
|
||||
}
|
||||
|
||||
fn options_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||
&mut self.options
|
||||
self.base.options_mut()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user