diff options
-rw-r--r-- | Cargo.lock | 8 | ||||
-rw-r--r-- | src/tree/tree_options.rs | 14 |
2 files changed, 17 insertions, 5 deletions
@@ -52,9 +52,9 @@ dependencies = [ [[package]] name = "ansi_term" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ "winapi", ] @@ -250,9 +250,9 @@ dependencies = [ [[package]] name = "clap" -version = "2.33.3" +version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "ansi_term", "atty", diff --git a/src/tree/tree_options.rs b/src/tree/tree_options.rs index f745d69..97d9c9c 100644 --- a/src/tree/tree_options.rs +++ b/src/tree/tree_options.rs @@ -8,6 +8,7 @@ use { pattern::*, }, clap::ArgMatches, + crossterm::style::Stylize, std::convert::TryFrom, }; @@ -81,7 +82,18 @@ impl TreeOptions { if let Some(default_flags) = &config.default_flags { let clap_app = clap_args::clap_app().setting(clap::AppSettings::NoBinaryName); let flags_args = format!("-{}", default_flags); - let conf_matches = clap_app.get_matches_from(vec![&flags_args]); + let conf_matches = match clap_app.get_matches_from_safe(vec![&flags_args]) { + Ok(cm) => cm, + Err(e) => { + error!("bad default_flags in conf: {:?}", default_flags); + eprintln!( + "{} Invalid default_flags in configuration file: \"{}\"", + "error:".red(), + default_flags.to_string().red(), + ); + e.exit(); + } + }; self.apply_launch_args(&conf_matches); } if let Some(b) = &config.show_selection_mark { |