Skip to content

Commit ac81b00

Browse files
committed
refactor(main): use GimError exit codes instead of implicit panics
main() now calls gim::run(args) which returns Result, and maps errors to stderr output with the correct exit code from GimError. No more process::exit() calls buried in library code.
1 parent 7f77cae commit ac81b00

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
use clap::Parser;
2+
13
fn main() {
2-
gim::run();
4+
let args = gim::cli::Cli::parse();
5+
6+
if let Err(e) = gim::run(args) {
7+
eprintln!("error: {e}");
8+
std::process::exit(e.exit_code());
9+
}
310
}

0 commit comments

Comments
 (0)