@@ -20,11 +20,15 @@ impl<'b> Controller<'b> {
2020 Controller { config, assets }
2121 }
2222
23− pub fn run(&self) -> Result<bool> {
24− self.run_with_error_handler(default_error_handler)
23+ pub fn run(&self, inputs: Vec<InputFile>) -> Result<bool> {
24+ self.run_with_error_handler(inputs, default_error_handler)
2525 }
2626
27− pub fn run_with_error_handler(&self, handle_error: impl Fn(&Error)) -> Result<bool> {
27+ pub fn run_with_error_handler(
28+ &self,
29+ inputs: Vec<InputFile>,
30+ handle_error: impl Fn(&Error),
31+ ) -> Result<bool> {
2832 let mut output_type;
2933
3034 #[cfg(feature = "paging")]
@@ -34,7 +38,7 @@ impl<'b> Controller<'b> {
3438 // Do not launch the pager if NONE of the input files exist
3539 let mut paging_mode = self.config.paging_mode;
3640 if self.config.paging_mode != PagingMode::Never {
37− let call_pager = self.config.files.iter().any(|file| {
41+ let call_pager = inputs.iter().any(|file| {
3842 if let InputFile::Ordinary(ofile) = file {
3943 return Path::new(ofile.provided_path()).exists();
4044 } else {
@@ -56,7 +60,7 @@ impl<'b> Controller<'b> {
5660 let writer = output_type.handle()?;
5761 let mut no_errors: bool = true;
5862
59− for input_file in self.config.files.iter() {
63+ for input_file in inputs.into_iter() {
6064 match input_file.get_reader(io::stdin().lock()) {
6165 Err(error) => {
6266 handle_error(&error);
@@ -65,15 +69,15 @@ impl<'b> Controller<'b> {
6569 Ok(mut reader) => {
6670 let result = if self.config.loop_through {
6771 let mut printer = SimplePrinter::new();
68− self.print_file(reader, &mut printer, writer, input_file)
72+ self.print_file(reader, &mut printer, writer, &input_file)
6973 } else {
7074 let mut printer = InteractivePrinter::new(
7175 &self.config,
7276 &self.assets,
73− input_file,
77+ &input_file,
7478 &mut reader,
7579 );
76− self.print_file(reader, &mut printer, writer, input_file)
80+ self.print_file(reader, &mut printer, writer, &input_file)
7781 };
7882
7983 if let Err(error) = result {