Skip to content

Commit

Permalink
Add a comment to get_matches_from for --help
Browse files Browse the repository at this point in the history
  • Loading branch information
elizabethengelman committed Nov 4, 2024
1 parent 32c9dd8 commit 0eb337b
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions cmd/soroban-cli/src/commands/contract/arg_parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,8 @@ pub fn build_host_function_parameters(
cmd.build();
let long_help = cmd.render_long_help();

match cmd.clone().try_get_matches_from(slop) {
Ok(m) => m,
Err(e) => {
println!("Failed to match subcommand: {}", e);
std::process::exit(1);
}
};

// get_matches_from exits if `help`, `--help` or `-h`are passed in the slop
// see clap documentation for more info: https://github.com/clap-rs/clap/blob/v4.1.8/src/builder/command.rs#L631
let mut matches_ = cmd.get_matches_from(slop);
let Some((function, matches_)) = &matches_.remove_subcommand() else {
println!("{long_help}");
Expand Down

0 comments on commit 0eb337b

Please sign in to comment.