mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-02 19:32:25 +01:00
[breaking] Remove special handling for theme previews
This commit is contained in:
28
src/input.rs
28
src/input.rs
@@ -6,8 +6,6 @@ use content_inspector::{self, ContentType};
|
||||
|
||||
use crate::error::*;
|
||||
|
||||
const THEME_PREVIEW_FILE: &[u8] = include_bytes!("../assets/theme_preview.rs");
|
||||
|
||||
/// A description of an Input source.
|
||||
/// This tells bat how to refer to the input.
|
||||
#[derive(Clone)]
|
||||
@@ -62,7 +60,6 @@ impl InputDescription {
|
||||
pub(crate) enum InputKind<'a> {
|
||||
OrdinaryFile(OsString),
|
||||
StdIn,
|
||||
ThemePreviewFile,
|
||||
CustomReader(Box<dyn Read + 'a>),
|
||||
}
|
||||
|
||||
@@ -73,7 +70,6 @@ impl<'a> InputKind<'a> {
|
||||
InputDescription::new(path.to_string_lossy()).with_kind(Some("File"))
|
||||
}
|
||||
InputKind::StdIn => InputDescription::new("STDIN"),
|
||||
InputKind::ThemePreviewFile => InputDescription::new(""),
|
||||
InputKind::CustomReader(_) => InputDescription::new("READER"),
|
||||
}
|
||||
}
|
||||
@@ -93,19 +89,9 @@ pub struct Input<'a> {
|
||||
pub(crate) enum OpenedInputKind {
|
||||
OrdinaryFile(OsString),
|
||||
StdIn,
|
||||
ThemePreviewFile,
|
||||
CustomReader,
|
||||
}
|
||||
|
||||
impl OpenedInputKind {
|
||||
pub(crate) fn is_theme_preview_file(&self) -> bool {
|
||||
match self {
|
||||
OpenedInputKind::ThemePreviewFile => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct OpenedInput<'a> {
|
||||
pub(crate) kind: OpenedInputKind,
|
||||
pub(crate) metadata: InputMetadata,
|
||||
@@ -130,14 +116,6 @@ impl<'a> Input<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn theme_preview_file() -> Self {
|
||||
Input {
|
||||
kind: InputKind::ThemePreviewFile,
|
||||
metadata: InputMetadata::default(),
|
||||
description: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_reader(reader: Box<dyn Read + 'a>) -> Self {
|
||||
Input {
|
||||
kind: InputKind::CustomReader(reader),
|
||||
@@ -196,12 +174,6 @@ impl<'a> Input<'a> {
|
||||
InputReader::new(BufReader::new(file))
|
||||
},
|
||||
}),
|
||||
InputKind::ThemePreviewFile => Ok(OpenedInput {
|
||||
kind: OpenedInputKind::ThemePreviewFile,
|
||||
description,
|
||||
metadata: self.metadata,
|
||||
reader: InputReader::new(THEME_PREVIEW_FILE),
|
||||
}),
|
||||
InputKind::CustomReader(reader) => Ok(OpenedInput {
|
||||
description,
|
||||
kind: OpenedInputKind::CustomReader,
|
||||
|
Reference in New Issue
Block a user