refactor: remove new_simple methods and replace with new(None, None)
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -37,9 +37,6 @@ impl BinaryMetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_simple() -> BinaryMetaPlugin {
|
||||
Self::new(None, None)
|
||||
}
|
||||
}
|
||||
|
||||
impl MetaPlugin for BinaryMetaPlugin {
|
||||
|
||||
@@ -40,9 +40,6 @@ impl CwdMetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_simple() -> CwdMetaPlugin {
|
||||
Self::new(None, None)
|
||||
}
|
||||
}
|
||||
|
||||
impl MetaPlugin for CwdMetaPlugin {
|
||||
|
||||
@@ -131,9 +131,6 @@ impl DigestMetaPlugin {
|
||||
plugin
|
||||
}
|
||||
|
||||
pub fn new_simple() -> DigestMetaPlugin {
|
||||
Self::new(None, None)
|
||||
}
|
||||
}
|
||||
|
||||
impl MetaPlugin for DigestMetaPlugin {
|
||||
|
||||
@@ -43,9 +43,6 @@ impl HostnameMetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_simple() -> HostnameMetaPlugin {
|
||||
Self::new(None, None)
|
||||
}
|
||||
|
||||
fn get_hostname(&self) -> String {
|
||||
// First get the short hostname
|
||||
|
||||
@@ -42,9 +42,6 @@ impl KeepPidMetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_simple() -> KeepPidMetaPlugin {
|
||||
Self::new(None, None)
|
||||
}
|
||||
}
|
||||
|
||||
impl MetaPlugin for KeepPidMetaPlugin {
|
||||
|
||||
@@ -57,9 +57,6 @@ impl MagicFileMetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_simple() -> MagicFileMetaPlugin {
|
||||
Self::new(None, None)
|
||||
}
|
||||
|
||||
fn get_magic_result(&self, flags: CookieFlags) -> io::Result<String> {
|
||||
// Use the existing cookie and just change flags
|
||||
|
||||
@@ -256,26 +256,25 @@ pub trait MetaPlugin where Self: 'static {
|
||||
}
|
||||
|
||||
pub fn get_meta_plugin(meta_plugin_type: MetaPluginType) -> Box<dyn MetaPlugin> {
|
||||
// For now, use new_simple() which passes None for options and outputs
|
||||
// The calling code should be updated to use a different function that accepts options and outputs
|
||||
// Use new(None, None) which passes None for options and outputs
|
||||
match meta_plugin_type {
|
||||
MetaPluginType::FileMagic => Box::new(MetaPluginProgram::new_simple("file", vec!["-bE", "-"], "file_magic".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_simple("file", vec!["-b", "--mime-encoding", "-"], "file_encoding".to_string(), true)),
|
||||
MetaPluginType::MagicFile => Box::new(MagicFileMetaPlugin::new_simple()),
|
||||
MetaPluginType::LineCount => Box::new(MetaPluginProgram::new_simple("wc", vec!["-l"], "line_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_simple()),
|
||||
MetaPluginType::Binary => Box::new(BinaryMetaPlugin::new_simple()),
|
||||
MetaPluginType::Text => Box::new(TextMetaPlugin::new_simple()),
|
||||
MetaPluginType::User => Box::new(UserMetaPlugin::new_simple()),
|
||||
MetaPluginType::Shell => Box::new(ShellMetaPlugin::new_simple()),
|
||||
MetaPluginType::ShellPid => Box::new(ShellPidMetaPlugin::new_simple()),
|
||||
MetaPluginType::KeepPid => Box::new(KeepPidMetaPlugin::new_simple()),
|
||||
MetaPluginType::Digest => Box::new(DigestMetaPlugin::new_simple()),
|
||||
MetaPluginType::ReadTime => Box::new(ReadTimeMetaPlugin::new_simple()),
|
||||
MetaPluginType::ReadRate => Box::new(ReadRateMetaPlugin::new_simple()),
|
||||
MetaPluginType::Hostname => Box::new(HostnameMetaPlugin::new_simple()),
|
||||
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)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,9 +77,6 @@ impl MetaPluginProgram {
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
@@ -47,9 +47,6 @@ impl ReadRateMetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_simple() -> ReadRateMetaPlugin {
|
||||
Self::new(None, None)
|
||||
}
|
||||
}
|
||||
|
||||
impl MetaPlugin for ReadRateMetaPlugin {
|
||||
|
||||
@@ -45,9 +45,6 @@ impl ReadTimeMetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_simple() -> ReadTimeMetaPlugin {
|
||||
Self::new(None, None)
|
||||
}
|
||||
}
|
||||
|
||||
impl MetaPlugin for ReadTimeMetaPlugin {
|
||||
|
||||
@@ -42,9 +42,6 @@ impl ShellMetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_simple() -> ShellMetaPlugin {
|
||||
Self::new(None, None)
|
||||
}
|
||||
}
|
||||
|
||||
impl MetaPlugin for ShellMetaPlugin {
|
||||
|
||||
@@ -43,9 +43,6 @@ impl ShellPidMetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_simple() -> ShellPidMetaPlugin {
|
||||
Self::new(None, None)
|
||||
}
|
||||
}
|
||||
|
||||
impl MetaPlugin for ShellPidMetaPlugin {
|
||||
|
||||
@@ -101,9 +101,6 @@ impl TextMetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_simple() -> TextMetaPlugin {
|
||||
Self::new(None, None)
|
||||
}
|
||||
|
||||
/// Count words and lines in a text chunk, handling block boundaries correctly
|
||||
fn count_text_stats(&mut self, data: &[u8]) {
|
||||
|
||||
@@ -25,9 +25,6 @@ impl UserMetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_simple() -> UserMetaPlugin {
|
||||
Self::new(None, None)
|
||||
}
|
||||
|
||||
fn get_current_username() -> Option<String> {
|
||||
uzers::get_user_by_uid(uzers::get_current_uid())
|
||||
|
||||
Reference in New Issue
Block a user