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/print.rs | |
parent | efd3ea97514545be187982bbe62d8ad012e17ebd (diff) |
add [ext-colors] to color files depending on their extension
Diffstat (limited to 'src/print.rs')
-rw-r--r-- | src/print.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/print.rs b/src/print.rs index 86313a3..d9364d8 100644 --- a/src/print.rs +++ b/src/print.rs @@ -6,7 +6,7 @@ use { display::{Cols, DisplayableTree, Screen}, errors::ProgramError, launchable::Launchable, - skin::{PanelSkin, StyleMap}, + skin::{ExtColorMap, PanelSkin, StyleMap}, tree::Tree, }, pathdiff, @@ -57,9 +57,10 @@ fn print_tree_to_file( screen: &mut Screen, file_path: &str, cols: &Cols, + ext_colors: &ExtColorMap, ) -> Result<AppStateCmdResult, ProgramError> { let no_style_skin = StyleMap::no_term(); - let dp = DisplayableTree::out_of_app(tree, &no_style_skin, cols, screen.width); + let dp = DisplayableTree::out_of_app(tree, &no_style_skin, cols, ext_colors, screen.width); let mut f = OpenOptions::new() .create(true) .append(true) @@ -76,7 +77,7 @@ pub fn print_tree( ) -> Result<AppStateCmdResult, ProgramError> { if let Some(ref output_path) = con.launch_args.file_export_path { // an output path was provided, we write to it - print_tree_to_file(tree, screen, output_path, &con.cols) + print_tree_to_file(tree, screen, output_path, &con.cols, &con.ext_colors) } else { // no output path provided. We write on stdout, but we must // do it after app closing to have the normal terminal @@ -90,6 +91,7 @@ pub fn print_tree( screen, styles, con.cols, + con.ext_colors.clone(), ))) } } |