use cursive::{event::Key, menu::MenuTree}; pub(crate) mod commands; pub(crate) mod gemini; pub(crate) mod theme; pub(crate) mod tls; fn main() { cursive::logger::init(); let mut siv = cursive::default(); theme::apply(&mut siv); siv.set_user_data(gemini::State::default()); siv.add_global_callback('c', |s| { s.pop_layer(); }); siv.add_global_callback('q', cursive::Cursive::quit); siv.add_global_callback('~', cursive::Cursive::toggle_debug_console); siv.add_global_callback('h', gemini::history); siv.add_global_callback('l', gemini::links); siv.add_global_callback('o', gemini::open_prompt); siv.add_global_callback('?', commands::help); siv.menubar() .add_subtree( "majc", MenuTree::new() .leaf("About", commands::about) .leaf("Changelog", commands::changelog) .leaf("Help", commands::help) .leaf("Quit", cursive::Cursive::quit), ) .add_leaf("Open", gemini::open_prompt) .add_leaf("Links", gemini::links) .add_leaf("History", gemini::history); siv.set_autohide_menu(false); siv.add_global_callback(Key::Esc, |s| s.select_menubar()); commands::help(&mut siv); siv.run(); }