diff options
author | Canop <cano.petrole@gmail.com> | 2022-06-07 18:59:31 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2022-06-07 18:59:31 +0200 |
commit | 1c61e362e614afebfd55591fbc37efde084795ad (patch) | |
tree | a449aa4864427dd38efad01b2d66bdb8e8a1ae75 /src/tree | |
parent | 4bcc94ba280eb342e585d9070ddc5adccfa39950 (diff) |
update from clap2 to clap3
Diffstat (limited to 'src/tree')
-rw-r--r-- | src/tree/tree_options.rs | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/tree/tree_options.rs b/src/tree/tree_options.rs index 97d9c9c..f1f5353 100644 --- a/src/tree/tree_options.rs +++ b/src/tree/tree_options.rs @@ -8,7 +8,6 @@ use { pattern::*, }, clap::ArgMatches, - crossterm::style::Stylize, std::convert::TryFrom, }; @@ -80,20 +79,9 @@ impl TreeOptions { /// change tree options according to configuration pub fn apply_config(&mut self, config: &Conf) -> Result<(), ConfError> { if let Some(default_flags) = &config.default_flags { - let clap_app = clap_args::clap_app().setting(clap::AppSettings::NoBinaryName); + let clap_app = clap_args::clap_app().no_binary_name(true); let flags_args = format!("-{}", default_flags); - 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(); - } - }; + let conf_matches = clap_app.get_matches_from(vec![&flags_args]); self.apply_launch_args(&conf_matches); } if let Some(b) = &config.show_selection_mark { @@ -111,7 +99,7 @@ impl TreeOptions { Ok(()) } /// change tree options according to broot launch arguments - pub fn apply_launch_args(&mut self, cli_args: &ArgMatches<'_>) { + pub fn apply_launch_args(&mut self, cli_args: &ArgMatches) { if cli_args.is_present("sizes") { self.show_sizes = true; self.show_root_fs = true; |