Skip to content

Commit

Permalink
fix(core): parse inner CLI subcommands, closes #4688 (#4841)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Aug 2, 2022
1 parent d6f7d3c commit dcd5066
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-cli-subcommand-matches.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": patch
---

Fixes CLI parser ignoring inner subcommands.
17 changes: 10 additions & 7 deletions core/tauri/src/api/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,16 @@ fn get_matches_internal(config: &CliConfig, matches: &ArgMatches) -> Matches {
map_matches(config, matches, &mut cli_matches);

if let Some((subcommand_name, subcommand_matches)) = matches.subcommand() {
let mut subcommand_cli_matches = Matches::default();
map_matches(
config.subcommands().unwrap().get(subcommand_name).unwrap(),
subcommand_matches,
&mut subcommand_cli_matches,
);
cli_matches.set_subcommand(subcommand_name.to_string(), subcommand_cli_matches);
if let Some(subcommand_config) = config
.subcommands
.as_ref()
.and_then(|s| s.get(subcommand_name))
{
cli_matches.set_subcommand(
subcommand_name.to_string(),
get_matches_internal(subcommand_config, subcommand_matches),
);
}
}

cli_matches
Expand Down

0 comments on commit dcd5066

Please sign in to comment.