From 4054034bb12414fd179c17a105855e86544d497a Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Fri, 15 Nov 2024 20:04:39 -0600 Subject: [PATCH] fix: space-separate multi-args Fixes #169 --- lib/src/parse.rs | 4 ++-- lib/tests/parse.rs | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/src/parse.rs b/lib/src/parse.rs index 2199160..b66ae85 100644 --- a/lib/src/parse.rs +++ b/lib/src/parse.rs @@ -290,7 +290,7 @@ impl ParseOutput { ParseValue::Bool(b) => if *b { "true" } else { "false" }.to_string(), ParseValue::String(s) => s.clone(), ParseValue::MultiBool(b) => b.iter().filter(|b| **b).count().to_string(), - ParseValue::MultiString(s) => s.join(","), + ParseValue::MultiString(s) => s.join(" "), }; env.insert(key, val); } @@ -300,7 +300,7 @@ impl ParseOutput { ParseValue::Bool(b) => if *b { "true" } else { "false" }.to_string(), ParseValue::String(s) => s.clone(), ParseValue::MultiBool(b) => b.iter().filter(|b| **b).count().to_string(), - ParseValue::MultiString(s) => s.join(","), + ParseValue::MultiString(s) => s.join(" "), }; env.insert(key, val); } diff --git a/lib/tests/parse.rs b/lib/tests/parse.rs index bb6e222..a5ea3b9 100644 --- a/lib/tests/parse.rs +++ b/lib/tests/parse.rs @@ -177,4 +177,11 @@ arg_default: "#, args="8081", expected=r#"{"usage_host": "localhost", "usage_port": "8081"}"#, + +multi_arg: + spec=r#" + arg "" var=true + "#, + args="a b c", + expected=r#"{"usage_vars": "a b c"}"#, }