1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-16 10:12:26 +01:00

Add InputDescription

This commit is contained in:
sharkdp
2020-04-21 22:24:47 +02:00
committed by David Peter
parent 3bacfc5184
commit f3b90ddb38
5 changed files with 139 additions and 107 deletions

View File

@@ -1,4 +1,5 @@
use std::ffi::OsStr;
use std::io::Read;
use crate::{
config::{
@@ -52,6 +53,18 @@ impl<'a> PrettyPrinter<'a> {
self
}
/// Add STDIN as an input
pub fn input_stdin(&mut self) -> &mut Self {
self.inputs.push(Input::StdIn(None));
self
}
/// Add STDIN as an input
pub fn input_reader(&mut self, reader: impl Read) -> &mut Self {
//self.inputs.push(Input::FromReader(Box::new(reader), None));
self
}
/// Specify the syntax file which should be used (default: auto-detect)
pub fn language(&mut self, language: &'a str) -> &mut Self {
self.config.language = Some(language);