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

Add paging to --list-themes

This commit is contained in:
einfachIrgendwer0815
2025-03-26 14:59:41 +01:00
parent fc7dff50b0
commit 12a2a451b4
8 changed files with 54 additions and 40 deletions

View File

@@ -1,3 +1,4 @@
use std::fmt;
use std::io::{self, Write};
#[cfg(feature = "paging")]
use std::process::Child;
@@ -162,3 +163,17 @@ impl Drop for OutputType {
}
}
}
pub enum OutputHandle<'a> {
IoWrite(&'a mut dyn io::Write),
FmtWrite(&'a mut dyn fmt::Write),
}
impl OutputHandle<'_> {
pub fn write_fmt(&mut self, args: fmt::Arguments<'_>) -> Result<()> {
match self {
Self::IoWrite(handle) => handle.write_fmt(args).map_err(Into::into),
Self::FmtWrite(handle) => handle.write_fmt(args).map_err(Into::into),
}
}
}