From 2523dc188cb9d8d32b23bf5e6c5ab7809aac6758 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sat, 23 Mar 2024 15:15:58 +0900 Subject: [PATCH] cli: allow to attach multiple hints to CommandError Even though the number of the hints is usually 0 or 1, this simplifies the API and hints handling. --- cli/src/cli_util.rs | 5 +--- cli/src/command_error.rs | 65 ++++++++++++++++++++-------------------- 2 files changed, 33 insertions(+), 37 deletions(-) diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index ffe296382..ffb34cae5 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -2591,9 +2591,6 @@ fn map_clap_cli_error( ui: &Ui, layered_configs: &LayeredConfigs, ) -> CommandError { - if cmd_err.hint.is_some() { - return cmd_err; - } let Some(err) = cmd_err.error.downcast_ref::() else { return cmd_err; }; @@ -2604,7 +2601,7 @@ fn map_clap_cli_error( if arg.as_str() == "--template