mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-30 16:10:23 +00:00
cli: propagate clap error from handle_early_args()
If we fail to parse the command line, even with `ignore_errors(true)` set, we currently let clap exit the process for us because we call `get_matches_from()`. We should instead propagate any errors and exit in `CliRunner::run()` as usual..
This commit is contained in:
parent
db87cb2c39
commit
9995415440
1 changed files with 1 additions and 1 deletions
|
@ -2280,7 +2280,7 @@ fn handle_early_args(
|
||||||
layered_configs: &mut LayeredConfigs,
|
layered_configs: &mut LayeredConfigs,
|
||||||
) -> Result<(), CommandError> {
|
) -> Result<(), CommandError> {
|
||||||
// ignore_errors() bypasses errors like "--help" or missing subcommand
|
// ignore_errors() bypasses errors like "--help" or missing subcommand
|
||||||
let early_matches = app.clone().ignore_errors(true).get_matches_from(args);
|
let early_matches = app.clone().ignore_errors(true).try_get_matches_from(args)?;
|
||||||
let mut args: EarlyArgs = EarlyArgs::from_arg_matches(&early_matches).unwrap();
|
let mut args: EarlyArgs = EarlyArgs::from_arg_matches(&early_matches).unwrap();
|
||||||
|
|
||||||
if let Some(choice) = args.color {
|
if let Some(choice) = args.color {
|
||||||
|
|
Loading…
Reference in a new issue