diff options
author | Canop <cano.petrole@gmail.com> | 2020-07-09 17:01:03 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2020-07-09 17:01:03 +0200 |
commit | d094c44ca6032fdc7f8c2da4bd31bc0aaeaa8adc (patch) | |
tree | 8612848721ec9e877163ca0c422f73c285829638 /src/conf/conf.rs | |
parent | efd3ea97514545be187982bbe62d8ad012e17ebd (diff) |
add [ext-colors] to color files depending on their extension
Diffstat (limited to 'src/conf/conf.rs')
-rw-r--r-- | src/conf/conf.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/conf/conf.rs b/src/conf/conf.rs index a17ce6a..4c008f5 100644 --- a/src/conf/conf.rs +++ b/src/conf/conf.rs @@ -11,7 +11,7 @@ use { keys, pattern::{SearchModeMap, SearchModeMapEntry}, selection_type::SelectionType, - skin::SkinEntry, + skin::{ExtColorMap, SkinEntry}, tree::*, verb::VerbConf, }, @@ -20,7 +20,6 @@ use { collections::HashMap, fs, io, path::{Path, PathBuf}, - result::Result, }, toml::{self, Value}, }; @@ -36,6 +35,7 @@ pub struct Conf { pub search_modes: SearchModeMap, pub disable_mouse_capture: bool, pub cols_order: Option<Cols>, + pub ext_colors: ExtColorMap, } fn string_field(value: &Value, field_name: &str) -> Option<String> { @@ -224,7 +224,16 @@ impl Conf { } } } - + } + // reading the ext_colors map + if let Some(Value::Table(ext_colors_tbl)) = &root.get("ext-colors") { + for (k, v) in ext_colors_tbl.iter() { + if let Some(v) = v.as_str() { + if let Err(e) = self.ext_colors.set(k.to_string(), v) { + eprintln!("{}", e); + } + } + } } Ok(()) |