chore: implement meta plugin type parsing in cmd_args_meta_plugin_types
This commit is contained in:
@@ -160,12 +160,23 @@ pub fn cmd_args_compression_type(cmd: &mut Command, args: &Args) -> CompressionT
|
||||
}
|
||||
|
||||
pub fn cmd_args_meta_plugin_types(cmd: &mut Command, args: &Args) -> Vec<MetaPluginType> {
|
||||
// TODO: Fix this
|
||||
let meta_plugin_names = args
|
||||
.item
|
||||
.meta_plugins
|
||||
.clone()
|
||||
.unwrap_or([]);
|
||||
.unwrap_or_else(|| vec![]);
|
||||
|
||||
// TOOD: Return a list of plugin types by loop over each name and converting it to a plugin type
|
||||
let mut meta_plugin_types = Vec::new();
|
||||
for name in meta_plugin_names {
|
||||
let meta_plugin_type_opt = MetaPluginType::from_str(&name);
|
||||
if meta_plugin_type_opt.is_err() {
|
||||
cmd.error(
|
||||
ErrorKind::InvalidValue,
|
||||
format!("Unknown meta plugin type: {}", name),
|
||||
)
|
||||
.exit();
|
||||
}
|
||||
meta_plugin_types.push(meta_plugin_type_opt.unwrap());
|
||||
}
|
||||
meta_plugin_types
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user