creddy/src-tauri/src/main.rs

31 lines
744 B
Rust
Raw Normal View History

#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
2023-05-15 13:09:26 -07:00
use creddy::{
app,
cli,
errors::ShowError,
2023-05-15 13:09:26 -07:00
};
2023-04-30 10:52:46 -07:00
fn main() {
2024-07-14 20:51:49 -04:00
let global_matches = cli::parser().get_matches();
let res = match global_matches.subcommand() {
None | Some(("run", _)) => {
2024-06-03 01:21:43 -04:00
app::run().error_popup("Creddy encountered an error");
Ok(())
},
2024-07-14 20:51:49 -04:00
Some(("get", m)) => cli::get(m, &global_matches),
Some(("exec", m)) => cli::exec(m, &global_matches),
Some(("shortcut", m)) => cli::invoke_shortcut(m, &global_matches),
_ => unreachable!(),
};
if let Err(e) = res {
eprintln!("Error: {e}");
std::process::exit(1);
}
}