1
0
mirror of https://github.com/sharkdp/bat synced 2026-08-08 19:41:45 +00:00

Updates for review of PR 899

This commit is contained in:
David Tolnay
2020-03-30 13:18:41 -07:00
committed by David Peter
parent 014d754588
commit 42e3825daf
5 changed files with 44 additions and 62 deletions
+6 -6
View File
@@ -2,6 +2,7 @@ use std::io::{self, Write};
#[cfg(feature = "paging")]
use std::process::Child;
#[cfg(feature = "paging")]
use crate::config::PagingMode;
use crate::errors::*;
#[cfg(feature = "paging")]
@@ -15,13 +16,12 @@ pub enum OutputType {
}
impl OutputType {
#[cfg(feature = "paging")]
pub fn from_mode(mode: PagingMode, pager: Option<&str>) -> Result<Self> {
let _ = pager;
use self::PagingMode::*;
Ok(match mode {
#[cfg(feature = "paging")]
PagingMode::Always => OutputType::try_pager(false, pager)?,
#[cfg(feature = "paging")]
PagingMode::QuitIfOneScreen => OutputType::try_pager(true, pager)?,
Always => OutputType::try_pager(false, pager)?,
QuitIfOneScreen => OutputType::try_pager(true, pager)?,
_ => OutputType::stdout(),
})
}
@@ -116,7 +116,7 @@ impl OutputType {
}
}
fn stdout() -> Self {
pub(crate) fn stdout() -> Self {
OutputType::Stdout(io::stdout())
}