tabiew 0.13.1

A lightweight TUI application to view and query tabular data files, such as CSV, TSV, and parquet.
use std::{
    io::{Cursor, IsTerminal, Read},
    sync::LazyLock,
};

use super::type_ext::UnwrapOrGracefulShutdown;

pub fn stdin() -> Cursor<&'static [u8]> {
    static STDIN_CONTENT: LazyLock<Vec<u8>> = LazyLock::new(|| {
        let mut buf = Vec::new();
        if !std::io::stdin().is_terminal() {
            std::io::stdin()
                .read_to_end(&mut buf)
                .unwrap_or_graceful_shutdown();
        }
        buf
    });
    Cursor::new(&STDIN_CONTENT)
}