From 7897260bf00fc017da383a783eede2583206acc5 Mon Sep 17 00:00:00 2001 From: ms2300 Date: Mon, 10 Sep 2018 21:58:19 -0600 Subject: [PATCH] BAT_STYLE accounts for multiple styles (ie numbers,header) --- src/app.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/app.rs b/src/app.rs index 8264914a..7a69285c 100644 --- a/src/app.rs +++ b/src/app.rs @@ -439,17 +439,17 @@ impl App { acc }) } else { - let style = env::var("BAT_STYLE").unwrap_or(String::from(BAT_STYLE_DEFAULT)); - match OutputComponent::from_str(&style) { - Ok(s) => [s] - .iter() - .map(|style| style.components(self.interactive_output)) - .fold(HashSet::new(), |mut acc, components| { - acc.extend(components.iter().cloned()); - acc - }), - Err(_) => HashSet::new(), - } + let style_str = env::var("BAT_STYLE").unwrap_or(String::from(BAT_STYLE_DEFAULT)); + style_str + .split(",") + .map(|x| OutputComponent::from_str(&x)) + .map(|s| match s { + Ok(style) => style.components(self.interactive_output), + Err(_) => &[], + }).fold(HashSet::new(), |mut acc, components| { + acc.extend(components.iter().cloned()); + acc + }) }, )) }