pub mod app;
pub mod book_toml;
pub mod book_toml_view;
pub mod github;
pub mod help;
pub mod home;
pub mod locale;
pub mod plotgen;
pub mod plotgen_view;
pub mod settings;
pub mod term;
pub mod theme;
pub mod update;
pub mod update_view;
pub mod widget;
use ratatui::Terminal;
use ratatui::backend::CrosstermBackend;
pub const EVENT_POLL_MS: u64 = 50;
pub const VIEW_FADE_MS: u32 = 160;
pub const UPDATE_SWEEP_MS: u32 = 180;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum View {
Home,
Update,
Config,
PlotGen,
}
#[derive(Debug, Clone, Copy, Default)]
pub struct TuiOptions {
pub dry_run: bool,
pub no_effects: bool,
pub no_preview: bool,
}
pub fn run(opts: TuiOptions) -> anyhow::Result<()> {
term::install_panic_hook();
let mut terminal = term::setup()?;
let mut app = app::App::new(opts);
let result = app.run(&mut terminal);
let _ = term::teardown(&mut terminal);
if let Some(text) = app.take_gen_output() {
println!("{text}");
}
result.map_err(Into::into)
}
pub type TerminalBackend = CrosstermBackend<std::io::Stdout>;
pub type TerminalType = Terminal<TerminalBackend>;