Skip to content

Commit f685df3

Browse files
authored
fix(cli): parsing of arguments with multiple values, closes #4231 (#4233)
1 parent 2c040ea commit f685df3

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"cli.rs": patch
3+
"cli.js": patch
4+
---
5+
6+
Fixes multiple occurrences handling of the `bundles` and `features` arguments.

tooling/cli/src/build.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ pub struct Options {
3232
/// Note that compiling an universal macOS application requires both `aarch64-apple-darwin` and `x86_64-apple-darwin` targets to be installed.
3333
#[clap(short, long)]
3434
target: Option<String>,
35-
/// List of cargo features to activate
36-
#[clap(short, long)]
35+
/// Space or comma separated list of features to activate
36+
#[clap(short, long, multiple_occurrences(true), multiple_values(true))]
3737
features: Option<Vec<String>>,
38-
/// List of bundles to package
39-
#[clap(short, long)]
38+
/// Space or comma separated list of bundles to package
39+
#[clap(short, long, multiple_occurrences(true), multiple_values(true))]
4040
bundles: Option<Vec<String>>,
4141
/// JSON string or path to JSON file to merge with tauri.conf.json
4242
#[clap(short, long)]
@@ -242,7 +242,10 @@ pub fn command(options: Options) -> Result<()> {
242242
if config_.tauri.bundle.active {
243243
let package_types = if let Some(names) = options.bundles {
244244
let mut types = vec![];
245-
for name in names {
245+
for name in names
246+
.into_iter()
247+
.flat_map(|n| n.split(',').map(|s| s.to_string()).collect::<Vec<String>>())
248+
{
246249
if name == "none" {
247250
break;
248251
}

tooling/cli/src/dev.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub struct Options {
5252
#[clap(short, long)]
5353
target: Option<String>,
5454
/// List of cargo features to activate
55-
#[clap(short, long)]
55+
#[clap(short, long, multiple_occurrences(true), multiple_values(true))]
5656
features: Option<Vec<String>>,
5757
/// Exit on panic
5858
#[clap(short, long)]

0 commit comments

Comments
 (0)