#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(
not(any(feature = "dynamic_output", feature = "static_output")),
allow(unused_imports),
allow(dead_code)
)]
#![deny(clippy::all)]
#![warn(clippy::pedantic)]
#![warn(clippy::nursery)]
#![cfg_attr(doctest, doc = include_str!("../README.md"))]
#[cfg(feature = "dynamic_output")]
mod dynamic_pager;
pub mod error;
pub mod hooks;
pub mod input;
#[path = "core/mod.rs"]
mod minus_core;
mod pager;
mod prompt;
pub mod screen;
#[cfg(feature = "search")]
#[cfg_attr(docsrs, doc(cfg(feature = "search")))]
pub mod search;
mod selection;
pub mod state;
#[cfg(feature = "static_output")]
mod static_pager;
#[cfg(feature = "dynamic_output")]
pub use dynamic_pager::{dynamic_paging, dynamic_paging_in_place};
#[cfg(feature = "static_output")]
pub use static_pager::page_all;
pub use minus_core::RunMode;
#[cfg(feature = "search")]
pub use search::SearchMode;
pub use error::MinusError;
pub use pager::Pager;
pub use prompt::{
PromptAttribute, PromptColor, PromptContext, PromptError, PromptLine, PromptRenderer,
PromptSpan, PromptStyle,
};
pub use state::PagerState;
pub type ExitCallbacks = Vec<Box<dyn FnMut() + Send + Sync + 'static>>;
type Result<T = (), E = MinusError> = std::result::Result<T, E>;
#[derive(PartialEq, Clone, Debug, Eq)]
pub enum ExitStrategy {
ProcessQuit,
PagerQuit,
}
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum LineNumbers {
AlwaysOn,
Enabled,
Disabled,
AlwaysOff,
}
impl LineNumbers {
const EXTRA_PADDING: usize = 5;
#[allow(dead_code)]
const fn is_invertible(self) -> bool {
matches!(self, Self::Enabled | Self::Disabled)
}
const fn is_on(self) -> bool {
matches!(self, Self::Enabled | Self::AlwaysOn)
}
}
impl std::ops::Not for LineNumbers {
type Output = Self;
fn not(self) -> Self::Output {
use LineNumbers::{Disabled, Enabled};
match self {
Enabled => Disabled,
Disabled => Enabled,
ln => ln,
}
}
}
#[cfg(test)]
mod tests;