1#![cfg(not(target_arch = "wasm32"))]
2
3use {
4 crate::{App, config, logger, theme},
5 color_eyre::Result,
6};
7
8pub async fn run() -> Result<()> {
9 config::init().await;
10
11 let theme_id = config::get(config::LAST_THEME)
12 .await
13 .and_then(|value| value.parse().ok())
14 .unwrap_or(theme::ThemeId::Dark);
15
16 theme::set_theme(theme_id);
17 config::update(config::LAST_THEME, theme_id.as_str()).await;
18
19 logger::init().await;
20 color_eyre::install()?;
21
22 let terminal = ratatui::init();
23 let app_result = App::new().run(terminal).await;
24 ratatui::restore();
25 app_result
26}
27
28pub async fn run_cli() -> Result<()> {
29 run().await
30}