From 811d6fe502af0c196d03ff238a35d05a9142a2a7 Mon Sep 17 00:00:00 2001 From: Elizabeth Engelman <4752801+elizabethengelman@users.noreply.github.com> Date: Mon, 4 Nov 2024 14:41:47 -0500 Subject: [PATCH] Add a comment to get_matches_from for --help --- cmd/soroban-cli/src/commands/contract/arg_parsing.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cmd/soroban-cli/src/commands/contract/arg_parsing.rs b/cmd/soroban-cli/src/commands/contract/arg_parsing.rs index ab61df1c1..21fa2f383 100644 --- a/cmd/soroban-cli/src/commands/contract/arg_parsing.rs +++ b/cmd/soroban-cli/src/commands/contract/arg_parsing.rs @@ -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 the process 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}");