feat: add is_default method to MetaPlugin and MetaPluginProgram

This commit is contained in:
Andrew Phillips (aider)
2025-05-22 13:42:41 -03:00
parent e2cb180a22
commit a0fb0dec8a
2 changed files with 13 additions and 3 deletions

View File

@@ -16,10 +16,11 @@ pub struct MetaPluginProgram {
pub args: Vec<String>,
pub supported: bool,
pub meta_name: String,
pub is_default: bool,
}
impl MetaPluginProgram {
pub fn new(program: &str, args: Vec<&str>, meta_name: String) -> MetaPluginProgram {
pub fn new(program: &str, args: Vec<&str>, meta_name: String, is_default: bool) -> MetaPluginProgram {
let program_path = get_program_path(program);
let supported = program_path.is_ok();
@@ -28,6 +29,7 @@ impl MetaPluginProgram {
args: args.iter().map(|s| s.to_string()).collect(),
supported,
meta_name,
is_default,
}
}
}
@@ -72,6 +74,10 @@ impl MetaPlugin for MetaPluginProgram {
fn meta_name(&mut self) -> String {
self.meta_name.clone()
}
fn is_default(&self) -> bool {
self.is_default
}
}
fn get_program_path(program: &str) -> Result<String> {