summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQrius <[email protected]>2024-11-13 09:53:51 +0100
committerQrius <[email protected]>2024-11-13 09:53:51 +0100
commit0481458808c035112b8be5e7ff0201f49093dc54 (patch)
tree72c0c01db5a53b022c2cc666243f4c024f70ed18 /src
parent1a27e733f961893b5cb1a92b1b9927e31631c936 (diff)
downloadskaldpress-0481458808c035112b8be5e7ff0201f49093dc54.tar.gz
skaldpress-0481458808c035112b8be5e7ff0201f49093dc54.zip
Make it possible to add metadata list as command line arguments
Diffstat (limited to 'src')
-rw-r--r--src/skaldpress/parseopts.rs11
1 files changed, 9 insertions, 2 deletions
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<String>, 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<String> = 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);