diff --git a/server/Cargo.lock b/server/Cargo.lock index 15fd33b..add9272 100644 --- a/server/Cargo.lock +++ b/server/Cargo.lock @@ -147,8 +147,7 @@ dependencies = [ [[package]] name = "bpaf" version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "863c0b21775e45ebf9bbb3a6d0cd9b3421c88a036e825359e3d4015561f3e23c" +source = "git+https://github.com/pacak/bpaf.git?branch=exit_code#77b8efc5d33adcf57901a03514a3ce6183144f8d" dependencies = [ "bpaf_derive", "owo-colors", @@ -157,8 +156,7 @@ dependencies = [ [[package]] name = "bpaf_derive" version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ed63113bfb3a9bb25dd131acdf0044c7404000ea57dd9eec1f221e3547b4748" +source = "git+https://github.com/pacak/bpaf.git?branch=exit_code#77b8efc5d33adcf57901a03514a3ce6183144f8d" dependencies = [ "proc-macro2", "quote", diff --git a/server/Cargo.toml b/server/Cargo.toml index 7a7a5fc..30d9a09 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -24,7 +24,7 @@ members = ["base", "db"] base = { package = "moonfire-base", path = "base" } base64 = "0.13.0" blake3 = "1.0.0" -bpaf = { version = "0.7.8", features = ["autocomplete", "bright-color", "derive"] } +bpaf = { git = "https://github.com/pacak/bpaf.git", branch = "exit_code", features = ["autocomplete", "bright-color", "derive"]} bytes = "1" byteorder = "1.0" cursive = "0.20.0" diff --git a/server/src/main.rs b/server/src/main.rs index 0c4bea5..324b167 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -144,17 +144,12 @@ fn main() { // TODO: remove this when bpaf adds more direct support for defaulting to `--help`. // See discussion: . if std::env::args_os().len() < 2 { - match args().run_inner(bpaf::Args::from(&["--help"])) { - Ok(a) => panic!("bpaf --help should not return Ok: {a:#?}"), - Err(bpaf::ParseFailure::Stdout(msg)) => { - print!("{msg}"); - std::process::exit(0); - } - Err(bpaf::ParseFailure::Stderr(msg)) => { - eprint!("{msg}"); - std::process::exit(1); - } - } + std::process::exit( + args() + .run_inner(bpaf::Args::from(&["--help"])) + .unwrap_err() + .exit_code(), + ); } let use_panic_hook = ::std::env::var("MOONFIRE_PANIC_HOOK")