summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2022-06-19 20:16:14 +0200
committerCanop <cano.petrole@gmail.com>2022-06-19 20:16:14 +0200
commit15e0d2acebaebf6db04794c53cf5a483a1503c24 (patch)
tree7a635c3c97ab1fa7ddd365b4f9078884d1042422
parent0a34abdf7e1fa4aaaf2da641b3083dd0b015f2da (diff)
fix default_flags in conf not working anymore
Fix #566
-rw-r--r--CHANGELOG.md3
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--src/errors.rs1
-rw-r--r--src/tree/tree_options.rs5
5 files changed, 10 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4b7baed..25c7907 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+### next
+- fix default_flags in conf not working anymore - Fix #566
+
### v1.13.2 - 2022-06-18
<a name="v1.13.2"></a>
- advice to hit alt-i and|or alt-h when no file is visible - Fix #556
diff --git a/Cargo.lock b/Cargo.lock
index 2d17da2..34bb637 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -137,7 +137,7 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "broot"
-version = "1.13.2"
+version = "1.13.3-dev"
dependencies = [
"ahash 0.7.6",
"ansi_colours",
diff --git a/Cargo.toml b/Cargo.toml
index d7fe063..07d7eb6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "broot"
-version = "1.13.2"
+version = "1.13.3-dev"
authors = ["dystroy <denys.seguret@gmail.com>"]
repository = "https://github.com/Canop/broot"
documentation = "https://dystroy.org/broot"
diff --git a/src/errors.rs b/src/errors.rs
index 2342f72..12283b4 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -57,6 +57,7 @@ custom_error! {pub ConfError
InvalidCols {details: String} = "invalid cols definition: {}",
InvalidSkin {source: InvalidSkinError} = "invalid skin: {}",
InvalidThreadsCount { count: usize } = "invalid threads count: {}",
+ InvalidDefaultFlags { flags: String } = "invalid default flags: {:?}",
}
// error which can be raised when parsing a pattern the user typed
diff --git a/src/tree/tree_options.rs b/src/tree/tree_options.rs
index 52f9b6c..7548e50 100644
--- a/src/tree/tree_options.rs
+++ b/src/tree/tree_options.rs
@@ -80,7 +80,10 @@ impl TreeOptions {
pub fn apply_config(&mut self, config: &Conf) -> Result<(), ConfError> {
if let Some(default_flags) = &config.default_flags {
let flags_args = format!("-{}", default_flags);
- let conf_matches = Args::parse_from(vec![&flags_args]);
+ let conf_matches = Args::try_parse_from(vec!["broot", &flags_args])
+ .map_err(|_| ConfError::InvalidDefaultFlags {
+ flags: default_flags.to_string()
+ })?;
self.apply_launch_args(&conf_matches);
}
if let Some(b) = &config.show_selection_mark {