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:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user