feat: add is_default method to MetaPlugin and MetaPluginProgram
This commit is contained in:
@@ -30,6 +30,10 @@ pub trait MetaPlugin {
|
||||
fn update(&mut self, data: &[u8]);
|
||||
|
||||
fn meta_name(&mut self) -> String;
|
||||
|
||||
fn is_default(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
use std::io::Write;
|
||||
@@ -37,7 +41,7 @@ use std::io::Write;
|
||||
lazy_static! {
|
||||
pub static ref META_PLUGIN_PROGRAMS: EnumMap<MetaPluginType, Option<MetaPluginProgram>> = enum_map! {
|
||||
MetaPluginType::FileMagic => {
|
||||
let program = MetaPluginProgram::new("file", vec!["-bE", "-"], "file_magic".to_string());
|
||||
let program = MetaPluginProgram::new("file", vec!["-bE", "-"], "file_magic".to_string(), true);
|
||||
if program.supported { Some(program) } else { None }
|
||||
}
|
||||
};
|
||||
@@ -45,7 +49,7 @@ lazy_static! {
|
||||
|
||||
pub fn get_meta_plugin(meta_plugin_type: MetaPluginType) -> Box<dyn MetaPlugin> {
|
||||
match meta_plugin_type {
|
||||
MetaPluginType::FileMagic => Box::new(MetaPluginProgram::new("file", vec!["-bE", "-"], "file_magic".to_string())),
|
||||
MetaPluginType::FileMagic => Box::new(MetaPluginProgram::new("file", vec!["-bE", "-"], "file_magic".to_string(), true)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user