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}");