feat: Implement clone_box for StripAnsiFilter and GrepFilter

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-09-03 07:49:53 -03:00
parent feb508bf27
commit 19188fabb9
3 changed files with 11 additions and 0 deletions

View File

@@ -27,4 +27,10 @@ impl FilterPlugin for GrepFilter {
}
Ok(())
}
fn clone_box(&self) -> Box<dyn FilterPlugin> {
Box::new(Self {
regex: self.regex.clone(),
})
}
}

View File

@@ -11,6 +11,7 @@ pub mod utils;
pub trait FilterPlugin: Send {
fn filter(&mut self, reader: Box<&mut dyn Read>, writer: Box<&mut dyn Write>) -> Result<()>;
fn clone_box(&self) -> Box<dyn FilterPlugin>;
}
#[derive(Debug, EnumString, strum::VariantNames)]

View File

@@ -16,4 +16,8 @@ impl FilterPlugin for StripAnsiFilter {
std::io::copy(&mut *reader, &mut ansi_writer)?;
ansi_writer.flush()
}
fn clone_box(&self) -> Box<dyn FilterPlugin> {
Box::new(Self)
}
}