1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-17 02:32:26 +01:00

Completely refactor 'input' module

This commit is contained in:
sharkdp
2020-04-22 16:27:34 +02:00
committed by David Peter
parent b4d54106fe
commit 590960f7f5
9 changed files with 233 additions and 200 deletions

View File

@@ -3,10 +3,10 @@ use std::io::Read;
use crate::{
config::{
Config, HighlightedLineRanges, Input, LineRanges, OrdinaryFile, StyleComponents,
SyntaxMapping, WrappingMode,
Config, HighlightedLineRanges, LineRanges, StyleComponents, SyntaxMapping, WrappingMode,
},
errors::Result,
input::{Input, InputKind, OpenedInput},
Controller, HighlightingAssets,
};
@@ -35,8 +35,8 @@ impl<'a> PrettyPrinter<'a> {
/// Add a file which should be pretty-printed
pub fn input_file(&mut self, path: &OsStr) -> &mut Self {
self.inputs
.push(Input::Ordinary(OrdinaryFile::from_path(path)));
// self.inputs
// .push(Input::Ordinary(OrdinaryFile::from_path(path)));
self
}
@@ -47,15 +47,15 @@ impl<'a> PrettyPrinter<'a> {
P: AsRef<OsStr>,
{
for path in paths {
self.inputs
.push(Input::Ordinary(OrdinaryFile::from_path(path.as_ref())));
// self.inputs
// .push(Input::Ordinary(OrdinaryFile::from_path(path.as_ref())));
}
self
}
/// Add STDIN as an input
pub fn input_stdin(&mut self) -> &mut Self {
self.inputs.push(Input::StdIn(None));
// self.inputs.push(Input::StdIn(None));
self
}