refactor: merge get_meta_plugin_with_config into get_meta_plugin
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -255,36 +255,15 @@ pub trait MetaPlugin where Self: 'static {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_meta_plugin(meta_plugin_type: MetaPluginType) -> Box<dyn MetaPlugin> {
|
||||
// Use new(None, None) which passes None for options and outputs
|
||||
match meta_plugin_type {
|
||||
MetaPluginType::FileMagic => Box::new(MetaPluginProgram::new("file", vec!["-bE", "-"], "file_magic".to_string(), true, None, None)),
|
||||
MetaPluginType::FileMime => Box::new(MetaPluginProgram::new("file", vec!["-b", "--mime-type", "-"], "file_mime".to_string(), true, None, None)),
|
||||
MetaPluginType::FileEncoding => Box::new(MetaPluginProgram::new("file", vec!["-b", "--mime-encoding", "-"], "file_encoding".to_string(), true, None, None)),
|
||||
MetaPluginType::MagicFile => Box::new(MagicFileMetaPlugin::new(None, None)),
|
||||
MetaPluginType::LineCount => Box::new(MetaPluginProgram::new("wc", vec!["-l"], "line_count".to_string(), true, None, None)),
|
||||
MetaPluginType::WordCount => Box::new(MetaPluginProgram::new("wc", vec!["-w"], "word_count".to_string(), true, None, None)),
|
||||
MetaPluginType::Cwd => Box::new(CwdMetaPlugin::new(None, None)),
|
||||
MetaPluginType::Binary => Box::new(BinaryMetaPlugin::new(None, None)),
|
||||
MetaPluginType::Text => Box::new(TextMetaPlugin::new(None, None)),
|
||||
MetaPluginType::User => Box::new(UserMetaPlugin::new(None, None)),
|
||||
MetaPluginType::Shell => Box::new(ShellMetaPlugin::new(None, None)),
|
||||
MetaPluginType::ShellPid => Box::new(ShellPidMetaPlugin::new(None, None)),
|
||||
MetaPluginType::KeepPid => Box::new(KeepPidMetaPlugin::new(None, None)),
|
||||
MetaPluginType::Digest => Box::new(DigestMetaPlugin::new(None, None)),
|
||||
MetaPluginType::ReadTime => Box::new(ReadTimeMetaPlugin::new(None, None)),
|
||||
MetaPluginType::ReadRate => Box::new(ReadRateMetaPlugin::new(None, None)),
|
||||
MetaPluginType::Hostname => Box::new(HostnameMetaPlugin::new(None, None)),
|
||||
}
|
||||
}
|
||||
|
||||
// Add a new function to create plugins with options and outputs
|
||||
pub fn get_meta_plugin_with_config(
|
||||
pub fn get_meta_plugin(
|
||||
meta_plugin_type: MetaPluginType,
|
||||
options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||
) -> Box<dyn MetaPlugin> {
|
||||
match meta_plugin_type {
|
||||
MetaPluginType::FileMagic => Box::new(MetaPluginProgram::new("file", vec!["-bE", "-"], "file_magic".to_string(), true, options, outputs)),
|
||||
MetaPluginType::FileMime => Box::new(MetaPluginProgram::new("file", vec!["-b", "--mime-type", "-"], "file_mime".to_string(), true, options, outputs)),
|
||||
MetaPluginType::FileEncoding => Box::new(MetaPluginProgram::new("file", vec!["-b", "--mime-encoding", "-"], "file_encoding".to_string(), true, options, outputs)),
|
||||
MetaPluginType::MagicFile => Box::new(MagicFileMetaPlugin::new(options, outputs)),
|
||||
MetaPluginType::LineCount => Box::new(MetaPluginProgram::new("wc", vec!["-l"], "line_count".to_string(), true, options, outputs)),
|
||||
MetaPluginType::WordCount => Box::new(MetaPluginProgram::new("wc", vec!["-w"], "word_count".to_string(), true, options, outputs)),
|
||||
|
||||
Reference in New Issue
Block a user