pub mod app;
mod event;
mod opener;
mod preview;
mod search;
mod theme;
mod ui;
pub use app::{App, AppResult};
pub use theme::Theme;
#[derive(Debug, Clone, Default)]
pub struct TuiConfig {
pub scan_on_startup: bool,
}
impl TuiConfig {
pub fn new() -> Self {
Self::default()
}
pub fn with_scan_on_startup(mut self, scan: bool) -> Self {
self.scan_on_startup = scan;
self
}
}
pub fn run(path: std::path::PathBuf) -> AppResult<()> {
run_with_config(path, TuiConfig::default())
}
pub fn run_with_config(path: std::path::PathBuf, config: TuiConfig) -> AppResult<()> {
let rt = tokio::runtime::Runtime::new()?;
let terminal = ratatui::init();
let result = rt.block_on(App::with_config(path, config).run(terminal));
ratatui::restore();
rt.shutdown_timeout(std::time::Duration::from_millis(100));
result
}