minus/static_pager.rs
1//! Contains function for displaying static data
2//!
3//! This module provides provides the [`page_all`] function to display static output via minus
4use crate::minus_core::init;
5use crate::{error::MinusError, Pager};
6
7/// Display static information to the screen
8///
9/// Since it is sure that fed data will never change, minus can do some checks like:-
10/// * If stdout is not a tty, minus not start a pager. It will simply print all the data and quit
11/// * If there are more rows in the terminal than the number of lines of data to display
12/// minus will not start a pager and simply display all data on the main stdout screen.
13/// This behaviour can be turned off if
14/// [`Pager::set_run_no_overflow(true)`](Pager::set_run_no_overflow) has been
15/// called before starting
16/// * Since any other event except user inputs will not occur, we can do some optimizations on
17/// matching events.
18///
19/// See [example](../index.html#static-output) on how to use this function.
20///
21/// # Panics
22/// This function will panic if another instance of minus is already running.
23///
24/// # Errors
25/// The function will return with an error if it encounters a error during paging.
26#[cfg_attr(docsrs, doc(cfg(feature = "static_output")))]
27#[allow(clippy::needless_pass_by_value)]
28pub fn page_all(pager: Pager) -> Result<(), MinusError> {
29 init::init_core(&pager, crate::RunMode::Static)
30}