From 2ba681315ce9255afaee8a2c7561c4fc1c304082 Mon Sep 17 00:00:00 2001 From: Domenico Mastrangelo Date: Thu, 6 Jun 2024 09:47:15 +0200 Subject: [PATCH] Added switch to plain style as default:w in case of loop_through = true --- src/controller.rs | 14 +++++++++++++- tests/integration_tests.rs | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/controller.rs b/src/controller.rs index ffc5dd5b..c619b091 100644 --- a/src/controller.rs +++ b/src/controller.rs @@ -15,6 +15,7 @@ use crate::output::OutputType; #[cfg(feature = "paging")] use crate::paging::PagingMode; use crate::printer::{InteractivePrinter, OutputHandle, Printer, SimplePrinter}; +use crate::style::{StyleComponent, StyleComponents}; use clircle::{Clircle, Identifier}; @@ -174,8 +175,19 @@ impl<'b> Controller<'b> { None }; + let mut config = self.config.clone(); + + if self.config.loop_through { + config = Config { + style_components: StyleComponents( + [StyleComponent::Plain].iter().cloned().collect(), + ), + ..self.config.clone() + }; + } + let mut printer: Box = if self.config.loop_through { - Box::new(SimplePrinter::new(self.config)) + Box::new(SimplePrinter::new(&config)) } else { Box::new(InteractivePrinter::new( self.config, diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 86ca104f..9b68bf8f 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -1779,7 +1779,7 @@ fn file_with_invalid_utf8_filename() { .arg(file_path.as_os_str()) .assert() .success() - .stdout(" 1 dummy content\n"); + .stdout("dummy content\n"); } #[test]