Added switch to plain style as default:w in case of loop_through = true

This commit is contained in:
Domenico Mastrangelo 2024-06-06 09:47:15 +02:00
parent c0c1fd69bc
commit 2ba681315c
2 changed files with 14 additions and 2 deletions

View File

@ -15,6 +15,7 @@ use crate::output::OutputType;
#[cfg(feature = "paging")] #[cfg(feature = "paging")]
use crate::paging::PagingMode; use crate::paging::PagingMode;
use crate::printer::{InteractivePrinter, OutputHandle, Printer, SimplePrinter}; use crate::printer::{InteractivePrinter, OutputHandle, Printer, SimplePrinter};
use crate::style::{StyleComponent, StyleComponents};
use clircle::{Clircle, Identifier}; use clircle::{Clircle, Identifier};
@ -174,8 +175,19 @@ impl<'b> Controller<'b> {
None 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<dyn Printer> = if self.config.loop_through { let mut printer: Box<dyn Printer> = if self.config.loop_through {
Box::new(SimplePrinter::new(self.config)) Box::new(SimplePrinter::new(&config))
} else { } else {
Box::new(InteractivePrinter::new( Box::new(InteractivePrinter::new(
self.config, self.config,

View File

@ -1779,7 +1779,7 @@ fn file_with_invalid_utf8_filename() {
.arg(file_path.as_os_str()) .arg(file_path.as_os_str())
.assert() .assert()
.success() .success()
.stdout(" 1 dummy content\n"); .stdout("dummy content\n");
} }
#[test] #[test]