From 4ef75a6917c9e3673d46e4dcc7002c967263b169 Mon Sep 17 00:00:00 2001 From: "Andrew Phillips (aider)" Date: Thu, 22 May 2025 15:44:58 -0300 Subject: [PATCH] chore: implement meta plugin type parsing in cmd_args_meta_plugin_types --- src/modes/common.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/modes/common.rs b/src/modes/common.rs index a6776f6..32d28aa 100644 --- a/src/modes/common.rs +++ b/src/modes/common.rs @@ -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 { - // 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 }