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 24b41b5
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 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,15 +63,10 @@ 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}");
std::process::exit(1);
Expand Down

0 comments on commit 24b41b5

Please sign in to comment.