2023-05-06 16:56:45 -07:00
|
|
|
#![cfg_attr(
|
|
|
|
all(not(debug_assertions), target_os = "windows"),
|
|
|
|
windows_subsystem = "windows"
|
|
|
|
)]
|
|
|
|
|
2023-05-15 13:09:26 -07:00
|
|
|
use creddy::{
|
|
|
|
app,
|
|
|
|
cli,
|
2023-09-21 10:44:35 -07:00
|
|
|
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() {
|
2023-05-06 12:01:56 -07:00
|
|
|
None | Some(("run", _)) => {
|
2024-06-03 01:21:43 -04:00
|
|
|
app::run().error_popup("Creddy encountered an error");
|
2023-05-06 12:01:56 -07:00
|
|
|
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),
|
2023-05-06 12:01:56 -07:00
|
|
|
_ => unreachable!(),
|
|
|
|
};
|
|
|
|
|
|
|
|
if let Err(e) = res {
|
|
|
|
eprintln!("Error: {e}");
|
2023-09-18 20:13:29 -07:00
|
|
|
std::process::exit(1);
|
2023-05-06 12:01:56 -07:00
|
|
|
}
|
2022-12-22 16:36:32 -08:00
|
|
|
}
|