use crossterm::{execute, terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}}; use ratatui::{ prelude::CrosstermBackend, Terminal, }; use std::io::{self, stdout, Stdout}; pub type Tui = Terminal>; pub fn init() -> io::Result { execute!(stdout(), EnterAlternateScreen)?; enable_raw_mode()?; Terminal::new(CrosstermBackend::new(stdout())) } pub fn restore() -> io::Result<()> { execute!(stdout(), LeaveAlternateScreen)?; disable_raw_mode()?; Ok(()) }