From 0481458808c035112b8be5e7ff0201f49093dc54 Mon Sep 17 00:00:00 2001 From: Qrius Date: Wed, 13 Nov 2024 09:53:51 +0100 Subject: Make it possible to add metadata list as command line arguments --- src/skaldpress/parseopts.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/skaldpress/parseopts.rs b/src/skaldpress/parseopts.rs index a0944a8..25d41fb 100644 --- a/src/skaldpress/parseopts.rs +++ b/src/skaldpress/parseopts.rs @@ -162,8 +162,15 @@ pub fn parseopt(opts: &mut OptsBuilder, arg: &str, value: Option, progna parseopts_panic!(progname); }; let parts: Vec<&str> = meta.split("=").collect(); - opts.metadata - .insert(String::from(parts[0]), str_to_yaml_value(parts[1])); + let val = parts[1]; + if val.contains(",") { + let val_parts: Vec = val.split(",").map(str::to_string).collect(); + opts.metadata + .insert(String::from(parts[0]), YamlValue::List(val_parts)); + } else { + opts.metadata + .insert(String::from(parts[0]), str_to_yaml_value(parts[1])); + } } "help" => { parseopts_panic!(progname); -- cgit v1.2.3