feat: update meta plugin constructors to accept options and outputs
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -145,26 +145,26 @@ pub trait MetaPlugin {
|
|||||||
|
|
||||||
pub fn get_meta_plugin(meta_plugin_type: MetaPluginType) -> Box<dyn MetaPlugin> {
|
pub fn get_meta_plugin(meta_plugin_type: MetaPluginType) -> Box<dyn MetaPlugin> {
|
||||||
match meta_plugin_type {
|
match meta_plugin_type {
|
||||||
MetaPluginType::FileMagic => Box::new(MetaPluginProgram::new("file", vec!["-bE", "-"], "file_magic".to_string(), true)),
|
MetaPluginType::FileMagic => Box::new(MetaPluginProgram::new_simple("file", vec!["-bE", "-"], "file_magic".to_string(), true)),
|
||||||
MetaPluginType::FileMime => Box::new(MetaPluginProgram::new("file", vec!["-b", "--mime-type", "-"], "file_mime".to_string(), true)),
|
MetaPluginType::FileMime => Box::new(MetaPluginProgram::new_simple("file", vec!["-b", "--mime-type", "-"], "file_mime".to_string(), true)),
|
||||||
MetaPluginType::FileEncoding => Box::new(MetaPluginProgram::new("file", vec!["-b", "--mime-encoding", "-"], "file_encoding".to_string(), true)),
|
MetaPluginType::FileEncoding => Box::new(MetaPluginProgram::new_simple("file", vec!["-b", "--mime-encoding", "-"], "file_encoding".to_string(), true)),
|
||||||
MetaPluginType::MagicFile => Box::new(MagicFileMetaPlugin::new()),
|
MetaPluginType::MagicFile => Box::new(MagicFileMetaPlugin::new_simple()),
|
||||||
MetaPluginType::LineCount => Box::new(MetaPluginProgram::new("wc", vec!["-l"], "line_count".to_string(), true)),
|
MetaPluginType::LineCount => Box::new(MetaPluginProgram::new_simple("wc", vec!["-l"], "line_count".to_string(), true)),
|
||||||
MetaPluginType::WordCount => Box::new(MetaPluginProgram::new("wc", vec!["-w"], "word_count".to_string(), true)),
|
MetaPluginType::WordCount => Box::new(MetaPluginProgram::new_simple("wc", vec!["-w"], "word_count".to_string(), true)),
|
||||||
MetaPluginType::Cwd => Box::new(CwdMetaPlugin::new()),
|
MetaPluginType::Cwd => Box::new(CwdMetaPlugin::new_simple()),
|
||||||
MetaPluginType::Binary => Box::new(BinaryMetaPlugin::new()),
|
MetaPluginType::Binary => Box::new(BinaryMetaPlugin::new_simple()),
|
||||||
MetaPluginType::Uid => Box::new(UidMetaPlugin::new()),
|
MetaPluginType::Uid => Box::new(UidMetaPlugin::new_simple()),
|
||||||
MetaPluginType::User => Box::new(UserMetaPlugin::new()),
|
MetaPluginType::User => Box::new(UserMetaPlugin::new_simple()),
|
||||||
MetaPluginType::Gid => Box::new(GidMetaPlugin::new()),
|
MetaPluginType::Gid => Box::new(GidMetaPlugin::new_simple()),
|
||||||
MetaPluginType::Group => Box::new(GroupMetaPlugin::new()),
|
MetaPluginType::Group => Box::new(GroupMetaPlugin::new_simple()),
|
||||||
MetaPluginType::Shell => Box::new(ShellMetaPlugin::new()),
|
MetaPluginType::Shell => Box::new(ShellMetaPlugin::new_simple()),
|
||||||
MetaPluginType::ShellPid => Box::new(ShellPidMetaPlugin::new()),
|
MetaPluginType::ShellPid => Box::new(ShellPidMetaPlugin::new_simple()),
|
||||||
MetaPluginType::KeepPid => Box::new(KeepPidMetaPlugin::new()),
|
MetaPluginType::KeepPid => Box::new(KeepPidMetaPlugin::new_simple()),
|
||||||
MetaPluginType::DigestSha256 => Box::new(DigestSha256MetaPlugin::new()),
|
MetaPluginType::DigestSha256 => Box::new(DigestSha256MetaPlugin::new_simple()),
|
||||||
MetaPluginType::DigestMd5 => Box::new(MetaPluginProgram::new("md5sum", vec![], "digest_md5".to_string(), true)),
|
MetaPluginType::DigestMd5 => Box::new(MetaPluginProgram::new_simple("md5sum", vec![], "digest_md5".to_string(), true)),
|
||||||
MetaPluginType::ReadTime => Box::new(ReadTimeMetaPlugin::new()),
|
MetaPluginType::ReadTime => Box::new(ReadTimeMetaPlugin::new_simple()),
|
||||||
MetaPluginType::ReadRate => Box::new(ReadRateMetaPlugin::new()),
|
MetaPluginType::ReadRate => Box::new(ReadRateMetaPlugin::new_simple()),
|
||||||
MetaPluginType::Hostname => Box::new(HostnameMetaPlugin::new()),
|
MetaPluginType::Hostname => Box::new(HostnameMetaPlugin::new_simple()),
|
||||||
MetaPluginType::FullHostname => Box::new(FullHostnameMetaPlugin::new()),
|
MetaPluginType::FullHostname => Box::new(FullHostnameMetaPlugin::new_simple()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,17 +15,48 @@ pub struct BinaryMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl BinaryMetaPlugin {
|
impl BinaryMetaPlugin {
|
||||||
pub fn new() -> BinaryMetaPlugin {
|
pub fn new(
|
||||||
|
options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> BinaryMetaPlugin {
|
||||||
|
// Start with default options
|
||||||
|
let mut final_options = Self::default_options();
|
||||||
|
if let Some(opts) = options {
|
||||||
|
for (key, value) in opts {
|
||||||
|
final_options.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
let default_outputs = Self::default_outputs();
|
||||||
|
for output_name in default_outputs {
|
||||||
|
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||||
|
}
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let max_buffer_size = final_options.get("max_buffer_size")
|
||||||
|
.and_then(|v| v.as_u64())
|
||||||
|
.unwrap_or(4096) as usize;
|
||||||
|
|
||||||
BinaryMetaPlugin {
|
BinaryMetaPlugin {
|
||||||
meta_name: "binary".to_string(),
|
meta_name: "binary".to_string(),
|
||||||
buffer: Vec::new(),
|
buffer: Vec::new(),
|
||||||
max_buffer_size: 4096, // 4KB
|
max_buffer_size,
|
||||||
is_saved: false,
|
is_saved: false,
|
||||||
item_id: None,
|
item_id: None,
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple() -> BinaryMetaPlugin {
|
||||||
|
Self::new(None, None)
|
||||||
|
}
|
||||||
|
|
||||||
fn save_metadata(&mut self, conn: &Connection) -> Result<()> {
|
fn save_metadata(&mut self, conn: &Connection) -> Result<()> {
|
||||||
if !self.is_saved {
|
if !self.is_saved {
|
||||||
if let Some(item_id) = self.item_id {
|
if let Some(item_id) = self.item_id {
|
||||||
|
|||||||
@@ -14,14 +14,34 @@ pub struct DigestSha256MetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl DigestSha256MetaPlugin {
|
impl DigestSha256MetaPlugin {
|
||||||
pub fn new() -> DigestSha256MetaPlugin {
|
pub fn new(
|
||||||
|
_options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> DigestSha256MetaPlugin {
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
let default_outputs = Self::default_outputs();
|
||||||
|
for output_name in default_outputs {
|
||||||
|
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||||
|
}
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DigestSha256MetaPlugin {
|
DigestSha256MetaPlugin {
|
||||||
hasher: Sha256::new(),
|
hasher: Sha256::new(),
|
||||||
meta_name: "digest_sha256".to_string(),
|
meta_name: "digest_sha256".to_string(),
|
||||||
item_id: None,
|
item_id: None,
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple() -> DigestSha256MetaPlugin {
|
||||||
|
Self::new(None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for DigestSha256MetaPlugin {
|
impl MetaPlugin for DigestSha256MetaPlugin {
|
||||||
@@ -80,13 +100,33 @@ pub struct ReadTimeMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ReadTimeMetaPlugin {
|
impl ReadTimeMetaPlugin {
|
||||||
pub fn new() -> ReadTimeMetaPlugin {
|
pub fn new(
|
||||||
|
_options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> ReadTimeMetaPlugin {
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
let default_outputs = Self::default_outputs();
|
||||||
|
for output_name in default_outputs {
|
||||||
|
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||||
|
}
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ReadTimeMetaPlugin {
|
ReadTimeMetaPlugin {
|
||||||
start_time: None,
|
start_time: None,
|
||||||
meta_name: "read_time".to_string(),
|
meta_name: "read_time".to_string(),
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple() -> ReadTimeMetaPlugin {
|
||||||
|
Self::new(None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for ReadTimeMetaPlugin {
|
impl MetaPlugin for ReadTimeMetaPlugin {
|
||||||
@@ -134,14 +174,34 @@ pub struct ReadRateMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ReadRateMetaPlugin {
|
impl ReadRateMetaPlugin {
|
||||||
pub fn new() -> ReadRateMetaPlugin {
|
pub fn new(
|
||||||
|
_options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> ReadRateMetaPlugin {
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
let default_outputs = Self::default_outputs();
|
||||||
|
for output_name in default_outputs {
|
||||||
|
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||||
|
}
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ReadRateMetaPlugin {
|
ReadRateMetaPlugin {
|
||||||
start_time: None,
|
start_time: None,
|
||||||
bytes_read: 0,
|
bytes_read: 0,
|
||||||
meta_name: "read_rate".to_string(),
|
meta_name: "read_rate".to_string(),
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple() -> ReadRateMetaPlugin {
|
||||||
|
Self::new(None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for ReadRateMetaPlugin {
|
impl MetaPlugin for ReadRateMetaPlugin {
|
||||||
|
|||||||
@@ -16,17 +16,49 @@ pub struct MagicFileMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl MagicFileMetaPlugin {
|
impl MagicFileMetaPlugin {
|
||||||
pub fn new() -> MagicFileMetaPlugin {
|
pub fn new(
|
||||||
|
options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> MagicFileMetaPlugin {
|
||||||
|
// Start with default options
|
||||||
|
let mut final_options = Self::default_options();
|
||||||
|
if let Some(opts) = options {
|
||||||
|
for (key, value) in opts {
|
||||||
|
final_options.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
let default_outputs = Self::default_outputs();
|
||||||
|
for output_name in default_outputs {
|
||||||
|
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||||
|
}
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let max_buffer_size = final_options.get("max_buffer_size")
|
||||||
|
.and_then(|v| v.as_u64())
|
||||||
|
.unwrap_or(4096) as usize;
|
||||||
|
|
||||||
MagicFileMetaPlugin {
|
MagicFileMetaPlugin {
|
||||||
buffer: Vec::new(),
|
buffer: Vec::new(),
|
||||||
max_buffer_size: 4096, // Same as BinaryMetaPlugin
|
max_buffer_size,
|
||||||
is_saved: false,
|
is_saved: false,
|
||||||
item_id: None,
|
item_id: None,
|
||||||
cookie: None,
|
cookie: None,
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple() -> MagicFileMetaPlugin {
|
||||||
|
Self::new(None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn get_magic_result(&self, flags: CookieFlags) -> io::Result<String> {
|
fn get_magic_result(&self, flags: CookieFlags) -> io::Result<String> {
|
||||||
// Use the existing cookie and just change flags
|
// Use the existing cookie and just change flags
|
||||||
if let Some(cookie) = &self.cookie {
|
if let Some(cookie) = &self.cookie {
|
||||||
|
|||||||
@@ -36,10 +36,26 @@ impl std::fmt::Debug for MetaPluginProgram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPluginProgram {
|
impl MetaPluginProgram {
|
||||||
pub fn new(program: &str, args: Vec<&str>, meta_name: String, split_whitespace: bool) -> MetaPluginProgram {
|
pub fn new(
|
||||||
|
program: &str,
|
||||||
|
args: Vec<&str>,
|
||||||
|
meta_name: String,
|
||||||
|
split_whitespace: bool,
|
||||||
|
options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> MetaPluginProgram {
|
||||||
let program_path = which(program);
|
let program_path = which(program);
|
||||||
let supported = program_path.is_ok();
|
let supported = program_path.is_ok();
|
||||||
|
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
final_outputs.insert(meta_name.clone(), serde_yaml::Value::String(meta_name.clone()));
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MetaPluginProgram {
|
MetaPluginProgram {
|
||||||
program: program_path.map_or_else(|_| program.to_string(), |p| p.to_string_lossy().to_string()),
|
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(),
|
args: args.iter().map(|s| s.to_string()).collect(),
|
||||||
@@ -50,9 +66,14 @@ impl MetaPluginProgram {
|
|||||||
writer: None,
|
writer: None,
|
||||||
item_id: None,
|
item_id: None,
|
||||||
result: None,
|
result: None,
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple(program: &str, args: Vec<&str>, meta_name: String, split_whitespace: bool) -> MetaPluginProgram {
|
||||||
|
Self::new(program, args, meta_name, split_whitespace, None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for MetaPluginProgram {
|
impl MetaPlugin for MetaPluginProgram {
|
||||||
|
|||||||
@@ -17,13 +17,33 @@ pub struct CwdMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CwdMetaPlugin {
|
impl CwdMetaPlugin {
|
||||||
pub fn new() -> CwdMetaPlugin {
|
pub fn new(
|
||||||
|
_options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> CwdMetaPlugin {
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
let default_outputs = Self::default_outputs();
|
||||||
|
for output_name in default_outputs {
|
||||||
|
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||||
|
}
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CwdMetaPlugin {
|
CwdMetaPlugin {
|
||||||
meta_name: "cwd".to_string(),
|
meta_name: "cwd".to_string(),
|
||||||
is_saved: false,
|
is_saved: false,
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple() -> CwdMetaPlugin {
|
||||||
|
Self::new(None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for CwdMetaPlugin {
|
impl MetaPlugin for CwdMetaPlugin {
|
||||||
@@ -80,13 +100,33 @@ pub struct UidMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl UidMetaPlugin {
|
impl UidMetaPlugin {
|
||||||
pub fn new() -> UidMetaPlugin {
|
pub fn new(
|
||||||
|
_options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> UidMetaPlugin {
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
let default_outputs = Self::default_outputs();
|
||||||
|
for output_name in default_outputs {
|
||||||
|
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||||
|
}
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UidMetaPlugin {
|
UidMetaPlugin {
|
||||||
meta_name: "uid".to_string(),
|
meta_name: "uid".to_string(),
|
||||||
is_saved: false,
|
is_saved: false,
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple() -> UidMetaPlugin {
|
||||||
|
Self::new(None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for UidMetaPlugin {
|
impl MetaPlugin for UidMetaPlugin {
|
||||||
@@ -139,13 +179,33 @@ pub struct UserMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl UserMetaPlugin {
|
impl UserMetaPlugin {
|
||||||
pub fn new() -> UserMetaPlugin {
|
pub fn new(
|
||||||
|
_options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> UserMetaPlugin {
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
let default_outputs = Self::default_outputs();
|
||||||
|
for output_name in default_outputs {
|
||||||
|
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||||
|
}
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UserMetaPlugin {
|
UserMetaPlugin {
|
||||||
meta_name: "user".to_string(),
|
meta_name: "user".to_string(),
|
||||||
is_saved: false,
|
is_saved: false,
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple() -> UserMetaPlugin {
|
||||||
|
Self::new(None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for UserMetaPlugin {
|
impl MetaPlugin for UserMetaPlugin {
|
||||||
@@ -201,13 +261,33 @@ pub struct GidMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl GidMetaPlugin {
|
impl GidMetaPlugin {
|
||||||
pub fn new() -> GidMetaPlugin {
|
pub fn new(
|
||||||
|
_options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> GidMetaPlugin {
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
let default_outputs = Self::default_outputs();
|
||||||
|
for output_name in default_outputs {
|
||||||
|
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||||
|
}
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GidMetaPlugin {
|
GidMetaPlugin {
|
||||||
meta_name: "gid".to_string(),
|
meta_name: "gid".to_string(),
|
||||||
is_saved: false,
|
is_saved: false,
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple() -> GidMetaPlugin {
|
||||||
|
Self::new(None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for GidMetaPlugin {
|
impl MetaPlugin for GidMetaPlugin {
|
||||||
@@ -260,13 +340,33 @@ pub struct GroupMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl GroupMetaPlugin {
|
impl GroupMetaPlugin {
|
||||||
pub fn new() -> GroupMetaPlugin {
|
pub fn new(
|
||||||
|
_options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> GroupMetaPlugin {
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
let default_outputs = Self::default_outputs();
|
||||||
|
for output_name in default_outputs {
|
||||||
|
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||||
|
}
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GroupMetaPlugin {
|
GroupMetaPlugin {
|
||||||
meta_name: "group".to_string(),
|
meta_name: "group".to_string(),
|
||||||
is_saved: false,
|
is_saved: false,
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple() -> GroupMetaPlugin {
|
||||||
|
Self::new(None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for GroupMetaPlugin {
|
impl MetaPlugin for GroupMetaPlugin {
|
||||||
@@ -322,13 +422,33 @@ pub struct ShellMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ShellMetaPlugin {
|
impl ShellMetaPlugin {
|
||||||
pub fn new() -> ShellMetaPlugin {
|
pub fn new(
|
||||||
|
_options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> ShellMetaPlugin {
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
let default_outputs = Self::default_outputs();
|
||||||
|
for output_name in default_outputs {
|
||||||
|
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||||
|
}
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ShellMetaPlugin {
|
ShellMetaPlugin {
|
||||||
meta_name: "shell".to_string(),
|
meta_name: "shell".to_string(),
|
||||||
is_saved: false,
|
is_saved: false,
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple() -> ShellMetaPlugin {
|
||||||
|
Self::new(None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for ShellMetaPlugin {
|
impl MetaPlugin for ShellMetaPlugin {
|
||||||
@@ -384,13 +504,33 @@ pub struct ShellPidMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ShellPidMetaPlugin {
|
impl ShellPidMetaPlugin {
|
||||||
pub fn new() -> ShellPidMetaPlugin {
|
pub fn new(
|
||||||
|
_options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> ShellPidMetaPlugin {
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
let default_outputs = Self::default_outputs();
|
||||||
|
for output_name in default_outputs {
|
||||||
|
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||||
|
}
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ShellPidMetaPlugin {
|
ShellPidMetaPlugin {
|
||||||
meta_name: "shell_pid".to_string(),
|
meta_name: "shell_pid".to_string(),
|
||||||
is_saved: false,
|
is_saved: false,
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple() -> ShellPidMetaPlugin {
|
||||||
|
Self::new(None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for ShellPidMetaPlugin {
|
impl MetaPlugin for ShellPidMetaPlugin {
|
||||||
@@ -446,13 +586,33 @@ pub struct KeepPidMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl KeepPidMetaPlugin {
|
impl KeepPidMetaPlugin {
|
||||||
pub fn new() -> KeepPidMetaPlugin {
|
pub fn new(
|
||||||
|
_options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> KeepPidMetaPlugin {
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
let default_outputs = Self::default_outputs();
|
||||||
|
for output_name in default_outputs {
|
||||||
|
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||||
|
}
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
KeepPidMetaPlugin {
|
KeepPidMetaPlugin {
|
||||||
meta_name: "keep_pid".to_string(),
|
meta_name: "keep_pid".to_string(),
|
||||||
is_saved: false,
|
is_saved: false,
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple() -> KeepPidMetaPlugin {
|
||||||
|
Self::new(None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for KeepPidMetaPlugin {
|
impl MetaPlugin for KeepPidMetaPlugin {
|
||||||
@@ -505,13 +665,33 @@ pub struct HostnameMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl HostnameMetaPlugin {
|
impl HostnameMetaPlugin {
|
||||||
pub fn new() -> HostnameMetaPlugin {
|
pub fn new(
|
||||||
|
_options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> HostnameMetaPlugin {
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
let default_outputs = Self::default_outputs();
|
||||||
|
for output_name in default_outputs {
|
||||||
|
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||||
|
}
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HostnameMetaPlugin {
|
HostnameMetaPlugin {
|
||||||
meta_name: "hostname".to_string(),
|
meta_name: "hostname".to_string(),
|
||||||
is_saved: false,
|
is_saved: false,
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple() -> HostnameMetaPlugin {
|
||||||
|
Self::new(None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for HostnameMetaPlugin {
|
impl MetaPlugin for HostnameMetaPlugin {
|
||||||
@@ -567,13 +747,33 @@ pub struct FullHostnameMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl FullHostnameMetaPlugin {
|
impl FullHostnameMetaPlugin {
|
||||||
pub fn new() -> FullHostnameMetaPlugin {
|
pub fn new(
|
||||||
|
_options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||||
|
) -> FullHostnameMetaPlugin {
|
||||||
|
// Start with default outputs
|
||||||
|
let mut final_outputs = std::collections::HashMap::new();
|
||||||
|
let default_outputs = Self::default_outputs();
|
||||||
|
for output_name in default_outputs {
|
||||||
|
final_outputs.insert(output_name.clone(), serde_yaml::Value::String(output_name));
|
||||||
|
}
|
||||||
|
if let Some(outs) = outputs {
|
||||||
|
for (key, value) in outs {
|
||||||
|
final_outputs.insert(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FullHostnameMetaPlugin {
|
FullHostnameMetaPlugin {
|
||||||
meta_name: "full_hostname".to_string(),
|
meta_name: "full_hostname".to_string(),
|
||||||
is_saved: false,
|
is_saved: false,
|
||||||
outputs: std::collections::HashMap::new(),
|
outputs: final_outputs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_simple() -> FullHostnameMetaPlugin {
|
||||||
|
Self::new(None, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for FullHostnameMetaPlugin {
|
impl MetaPlugin for FullHostnameMetaPlugin {
|
||||||
|
|||||||
Reference in New Issue
Block a user