mirror of
https://github.com/sharkdp/bat
synced 2024-11-04 18:00:24 +00:00
Move PagingMode to separate module
This commit is contained in:
parent
17f3a3b95d
commit
8961f7aef8
@ -15,10 +15,11 @@ use console::Term;
|
||||
|
||||
use bat::{
|
||||
assets::HighlightingAssets,
|
||||
config::{Config, PagingMode},
|
||||
config::Config,
|
||||
error::*,
|
||||
input::Input,
|
||||
line_range::{HighlightedLineRanges, LineRange, LineRanges},
|
||||
paging::PagingMode,
|
||||
style::{StyleComponent, StyleComponents},
|
||||
MappingTarget, SyntaxMapping, WrappingMode,
|
||||
};
|
||||
|
@ -1,23 +1,10 @@
|
||||
use crate::line_range::{HighlightedLineRanges, LineRanges};
|
||||
#[cfg(feature = "paging")]
|
||||
use crate::paging::PagingMode;
|
||||
use crate::style::StyleComponents;
|
||||
use crate::syntax_mapping::SyntaxMapping;
|
||||
use crate::wrapping::WrappingMode;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[cfg(feature = "paging")]
|
||||
pub enum PagingMode {
|
||||
Always,
|
||||
QuitIfOneScreen,
|
||||
Never,
|
||||
}
|
||||
|
||||
#[cfg(feature = "paging")]
|
||||
impl Default for PagingMode {
|
||||
fn default() -> Self {
|
||||
PagingMode::Never
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct Config<'a> {
|
||||
/// The explicitly configured language, if any
|
||||
|
@ -2,12 +2,12 @@ use std::io::{self, Write};
|
||||
|
||||
use crate::assets::HighlightingAssets;
|
||||
use crate::config::Config;
|
||||
#[cfg(feature = "paging")]
|
||||
use crate::config::PagingMode;
|
||||
use crate::error::*;
|
||||
use crate::input::{Input, InputReader, OpenedInput};
|
||||
use crate::line_range::{LineRanges, RangeCheckResult};
|
||||
use crate::output::OutputType;
|
||||
#[cfg(feature = "paging")]
|
||||
use crate::paging::PagingMode;
|
||||
use crate::printer::{InteractivePrinter, Printer, SimplePrinter};
|
||||
|
||||
pub struct Controller<'a> {
|
||||
|
@ -29,6 +29,8 @@ pub mod input;
|
||||
mod less;
|
||||
pub mod line_range;
|
||||
mod output;
|
||||
#[cfg(feature = "paging")]
|
||||
pub mod paging;
|
||||
mod preprocessor;
|
||||
mod pretty_printer;
|
||||
pub(crate) mod printer;
|
||||
@ -42,4 +44,4 @@ pub use syntax_mapping::{MappingTarget, SyntaxMapping};
|
||||
pub use wrapping::WrappingMode;
|
||||
|
||||
#[cfg(feature = "paging")]
|
||||
pub use config::PagingMode;
|
||||
pub use paging::PagingMode;
|
||||
|
@ -2,11 +2,11 @@ use std::io::{self, Write};
|
||||
#[cfg(feature = "paging")]
|
||||
use std::process::Child;
|
||||
|
||||
#[cfg(feature = "paging")]
|
||||
use crate::config::PagingMode;
|
||||
use crate::error::*;
|
||||
#[cfg(feature = "paging")]
|
||||
use crate::less::retrieve_less_version;
|
||||
#[cfg(feature = "paging")]
|
||||
use crate::paging::PagingMode;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum OutputType {
|
||||
|
12
src/paging.rs
Normal file
12
src/paging.rs
Normal file
@ -0,0 +1,12 @@
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum PagingMode {
|
||||
Always,
|
||||
QuitIfOneScreen,
|
||||
Never,
|
||||
}
|
||||
|
||||
impl Default for PagingMode {
|
||||
fn default() -> Self {
|
||||
PagingMode::Never
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ use crate::{
|
||||
};
|
||||
|
||||
#[cfg(feature = "paging")]
|
||||
use crate::config::PagingMode;
|
||||
use crate::paging::PagingMode;
|
||||
|
||||
#[derive(Default)]
|
||||
struct ActiveStyleComponents {
|
||||
|
Loading…
Reference in New Issue
Block a user