refactor: remove is_default from meta plugins and add read_time/read_rate plugins

Co-authored-by: aider (openai/andrew.openrouter.qwen.qwen3-coder) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-07-29 11:32:48 -03:00
parent ee6869a94c
commit d530f1bc43
3 changed files with 15 additions and 18 deletions

View File

@@ -40,9 +40,6 @@ impl MetaPlugin for DigestSha256MetaPlugin {
self.meta_name.clone()
}
fn is_default(&self) -> bool {
true
}
}
// Dummy writer that implements Write but doesn't do anything

View File

@@ -16,12 +16,12 @@ pub struct MetaPluginProgram {
pub args: Vec<String>,
pub supported: bool,
pub meta_name: String,
pub is_default: bool,
pub split_whitespace: bool,
buffer: Vec<u8>,
}
impl MetaPluginProgram {
pub fn new(program: &str, args: Vec<&str>, meta_name: String, is_default: bool) -> MetaPluginProgram {
pub fn new(program: &str, args: Vec<&str>, meta_name: String, split_whitespace: bool) -> MetaPluginProgram {
let program_path = get_program_path(program);
let supported = program_path.is_ok();
@@ -30,7 +30,7 @@ impl MetaPluginProgram {
args: args.iter().map(|s| s.to_string()).collect(),
supported,
meta_name,
is_default,
split_whitespace,
buffer: Vec::new(),
}
}
@@ -90,8 +90,8 @@ impl MetaPlugin for MetaPluginProgram {
let stdout = String::from_utf8_lossy(&output.stdout);
let trimmed_result = stdout.trim();
// For certain programs like md5sum, we only want the first part before whitespace
if self.program.ends_with("sum") {
// For certain programs, we only want the first part before whitespace
if self.split_whitespace {
let parts: Vec<&str> = trimmed_result.split_whitespace().collect();
if !parts.is_empty() {
Ok(parts[0].to_string())
@@ -118,9 +118,6 @@ impl MetaPlugin for MetaPluginProgram {
self.meta_name.clone()
}
fn is_default(&self) -> bool {
self.is_default
}
}
fn get_program_path(program: &str) -> Result<String> {