mant 0.11.0

Local-first TUI, structured CLI, and MCP server for manuals and Markdown
//! Contains function for displaying static data
//!
//! This module provides provides the [`page_all`] function to display static output via minus
use crate::delivery::pager::native::minus_core::init;
use crate::delivery::pager::native::{Pager, error::MinusError};

/// Display static information to the screen
///
/// Since it is sure that fed data will never change, minus can do some checks like:-
/// * If stdout is not a tty, minus not start a pager. It will simply print all the data and quit
/// * If there are more rows in the terminal than the number of lines of data to display
///   minus will not start a pager and simply display all data on the main stdout screen.
///   This behaviour can be turned off if
///   [`Pager::set_run_no_overflow(true)`](Pager::set_run_no_overflow) has been
///   called before starting
/// * Since any other event except user inputs will not occur, we can do some optimizations on
///   matching events.
///
/// See [example](../index.html#static-output) on how to use this function.
///
/// # Panics
/// This function will panic if another instance of minus is already running.
///
/// # Errors
/// The function will return with an error if it encounters a error during paging.
#[allow(clippy::needless_pass_by_value)]
pub fn page_all(
    pager: Pager,
    terminal: &std::sync::Arc<crate::delivery::pager::lifecycle::PagerTerminal>,
) -> Result<(), MinusError> {
    init::init_core(&pager, crate::delivery::pager::native::RunMode::Static, terminal)
}