creddy/src-tauri/src/main.rs

31 lines
747 B
Rust

#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
use creddy::{
app,
errors::ShowError,
};
use creddy_cli::{Action, Cli};
fn main() {
let cli = Cli::parse();
let res = match cli.action {
None | Some(Action::Run) => {
app::run().error_popup("Creddy encountered an error");
Ok(())
},
Some(Action::Get(args)) => creddy_cli::get(args, cli.global_args),
Some(Action::Exec(args)) => creddy_cli::exec(args, cli.global_args),
Some(Action::Shortcut(args)) => creddy_cli::invoke_shortcut(args, cli.global_args),
};
if let Err(e) = res {
eprintln!("Error: {e}");
std::process::exit(1);
}
}