Skip to content

Commit dcd5066

Browse files
authored
fix(core): parse inner CLI subcommands, closes #4688 (#4841)
1 parent d6f7d3c commit dcd5066

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Fixes CLI parser ignoring inner subcommands.

core/tauri/src/api/cli.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,16 @@ fn get_matches_internal(config: &CliConfig, matches: &ArgMatches) -> Matches {
136136
map_matches(config, matches, &mut cli_matches);
137137

138138
if let Some((subcommand_name, subcommand_matches)) = matches.subcommand() {
139-
let mut subcommand_cli_matches = Matches::default();
140-
map_matches(
141-
config.subcommands().unwrap().get(subcommand_name).unwrap(),
142-
subcommand_matches,
143-
&mut subcommand_cli_matches,
144-
);
145-
cli_matches.set_subcommand(subcommand_name.to_string(), subcommand_cli_matches);
139+
if let Some(subcommand_config) = config
140+
.subcommands
141+
.as_ref()
142+
.and_then(|s| s.get(subcommand_name))
143+
{
144+
cli_matches.set_subcommand(
145+
subcommand_name.to_string(),
146+
get_matches_internal(subcommand_config, subcommand_matches),
147+
);
148+
}
146149
}
147150

148151
cli_matches

0 commit comments

Comments
 (0)