feat: add meta_name support to MetaPluginProgram
This commit is contained in:
@@ -15,10 +15,11 @@ pub struct MetaPluginProgram {
|
|||||||
pub program: String,
|
pub program: String,
|
||||||
pub args: Vec<String>,
|
pub args: Vec<String>,
|
||||||
pub supported: bool,
|
pub supported: bool,
|
||||||
|
pub meta_name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPluginProgram {
|
impl MetaPluginProgram {
|
||||||
pub fn new(program: &str, args: Vec<&str>) -> MetaPluginProgram {
|
pub fn new(program: &str, args: Vec<&str>, meta_name: String) -> MetaPluginProgram {
|
||||||
let program_path = get_program_path(program);
|
let program_path = get_program_path(program);
|
||||||
let supported = program_path.is_ok();
|
let supported = program_path.is_ok();
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ impl MetaPluginProgram {
|
|||||||
program: program_path.unwrap_or(program.to_string()),
|
program: program_path.unwrap_or(program.to_string()),
|
||||||
args: args.iter().map(|s| s.to_string()).collect(),
|
args: args.iter().map(|s| s.to_string()).collect(),
|
||||||
supported,
|
supported,
|
||||||
|
meta_name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,6 +68,10 @@ impl MetaPlugin for MetaPluginProgram {
|
|||||||
fn update(&mut self, _data: &[u8]) {
|
fn update(&mut self, _data: &[u8]) {
|
||||||
// This is handled by the ProgramWriter implementation
|
// This is handled by the ProgramWriter implementation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn meta_name(&mut self) -> String {
|
||||||
|
self.meta_name.clone()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_program_path(program: &str) -> Result<String> {
|
fn get_program_path(program: &str) -> Result<String> {
|
||||||
|
|||||||
Reference in New Issue
Block a user