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