Skip to content

Commit

Permalink
fix: space-separate multi-args
Browse files Browse the repository at this point in the history
Fixes #169
  • Loading branch information
jdx committed Nov 16, 2024
1 parent 1a0ec3b commit 4054034
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
7 changes: 7 additions & 0 deletions lib/tests/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,11 @@ arg_default:
"#,
args="8081",
expected=r#"{"usage_host": "localhost", "usage_port": "8081"}"#,

multi_arg:
spec=r#"
arg "<vars>" var=true
"#,
args="a b c",
expected=r#"{"usage_vars": "a b c"}"#,
}

0 comments on commit 4054034

Please sign in to comment.