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/launchable.rs | |
parent | efd3ea97514545be187982bbe62d8ad012e17ebd (diff) |
add [ext-colors] to color files depending on their extension
Diffstat (limited to 'src/launchable.rs')
-rw-r--r-- | src/launchable.rs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/launchable.rs b/src/launchable.rs index 0c81b22..c24403b 100644 --- a/src/launchable.rs +++ b/src/launchable.rs @@ -1,8 +1,16 @@ use { crate::{ - display::{Cols, DisplayableTree, Screen, W}, + display::{ + Cols, + DisplayableTree, + Screen, + W, + }, errors::ProgramError, - skin::StyleMap, + skin::{ + ExtColorMap, + StyleMap, + }, tree::Tree, }, crossterm::{ @@ -31,6 +39,7 @@ pub enum Launchable { tree: Box<Tree>, skin: Box<StyleMap>, cols: Cols, + ext_colors: ExtColorMap, width: u16, }, Program { @@ -72,11 +81,13 @@ impl Launchable { screen: &Screen, style_map: StyleMap, cols: Cols, + ext_colors: ExtColorMap, ) -> Launchable { Launchable::TreePrinter { tree: Box::new(tree.clone()), skin: Box::new(style_map), cols, + ext_colors, width: screen.width, } } @@ -98,8 +109,8 @@ impl Launchable { println!("{}", to_print); Ok(()) } - Launchable::TreePrinter { tree, skin, cols, width } => { - let dp = DisplayableTree::out_of_app(&tree, &skin, &cols, *width); + Launchable::TreePrinter { tree, skin, cols, ext_colors, width } => { + let dp = DisplayableTree::out_of_app(&tree, &skin, &cols, &ext_colors, *width); dp.write_on(&mut std::io::stdout()) } Launchable::Program { exe, args } => { |