Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
Add human-panic setup to radicle-cli
Merged did:key:z6MkwcUR...q1kL opened 8 months ago

This patchset adds a human_panic setup to the radicle-cli crates main() function. Its an alternative approach to the changes in the patchset at

rad/patches/f238147e5b0ab4090c94fcca5c2b2565ae7b75df

which uses the log-panics crate, which seems to be unmaintained (as the author of above patchset also notes).

human-panic is maintained by the rust-cli org, and is actively maintained. So I think it is a good choice. I am open to suggestions about the metadata passed to the setup_panic() call of course!

4 files changed +240 -7 f6f3be43 6a1b13bb
modified Cargo.lock
@@ -3,6 +3,15 @@
version = 4

[[package]]
+
name = "addr2line"
+
version = "0.24.2"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
+
dependencies = [
+
 "gimli",
+
]
+

+
[[package]]
name = "adler2"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -50,7 +59,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
dependencies = [
 "cfg-if",
-
 "getrandom",
+
 "getrandom 0.2.15",
 "once_cell",
 "serde",
 "version_check",
@@ -198,6 +207,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"

[[package]]
+
name = "backtrace"
+
version = "0.3.75"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002"
+
dependencies = [
+
 "addr2line",
+
 "cfg-if",
+
 "libc",
+
 "miniz_oxide",
+
 "object",
+
 "rustc-demangle",
+
 "windows-targets 0.52.6",
+
]
+

+
[[package]]
name = "base-x"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -667,6 +691,15 @@ dependencies = [
]

[[package]]
+
name = "deranged"
+
version = "0.4.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e"
+
dependencies = [
+
 "powerfmt",
+
]
+

+
[[package]]
name = "derive_more"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -739,7 +772,7 @@ checksum = "bdfd533a2fc01178c738c99412ae1f7e1ad2cb37c2e14bfd87e9d4618171c825"
dependencies = [
 "ct-codecs",
 "ed25519",
-
 "getrandom",
+
 "getrandom 0.2.15",
]

[[package]]
@@ -989,7 +1022,19 @@ checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [
 "cfg-if",
 "libc",
-
 "wasi",
+
 "wasi 0.11.0+wasi-snapshot-preview1",
+
]
+

+
[[package]]
+
name = "getrandom"
+
version = "0.3.3"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
+
dependencies = [
+
 "cfg-if",
+
 "libc",
+
 "r-efi",
+
 "wasi 0.14.2+wasi-0.2.4",
]

[[package]]
@@ -1003,6 +1048,12 @@ dependencies = [
]

[[package]]
+
name = "gimli"
+
version = "0.31.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
+

+
[[package]]
name = "git-ref-format"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1577,6 +1628,22 @@ dependencies = [
]

[[package]]
+
name = "human-panic"
+
version = "2.0.3"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "ac63a746b187e95d51fe16850eb04d1cfef203f6af98e6c405a6f262ad3df00a"
+
dependencies = [
+
 "anstream",
+
 "anstyle",
+
 "backtrace",
+
 "os_info",
+
 "serde",
+
 "serde_derive",
+
 "toml",
+
 "uuid",
+
]
+

+
[[package]]
name = "iana-time-zone"
version = "0.1.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2029,7 +2096,7 @@ checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
dependencies = [
 "libc",
 "log",
-
 "wasi",
+
 "wasi 0.11.0+wasi-snapshot-preview1",
 "windows-sys 0.48.0",
]

@@ -2041,7 +2108,7 @@ checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c"
dependencies = [
 "libc",
 "log",
-
 "wasi",
+
 "wasi 0.11.0+wasi-snapshot-preview1",
 "windows-sys 0.59.0",
]

@@ -2178,6 +2245,12 @@ dependencies = [
]

[[package]]
+
name = "num-conv"
+
version = "0.1.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
+

+
[[package]]
name = "num-integer"
version = "0.1.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2219,6 +2292,15 @@ dependencies = [
]

[[package]]
+
name = "object"
+
version = "0.36.7"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87"
+
dependencies = [
+
 "memchr",
+
]
+

+
[[package]]
name = "once_cell"
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2231,6 +2313,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"

[[package]]
+
name = "os_info"
+
version = "3.12.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "d0e1ac5fde8d43c34139135df8ea9ee9465394b2d8d20f032d38998f64afffc3"
+
dependencies = [
+
 "log",
+
 "plist",
+
 "serde",
+
 "windows-sys 0.52.0",
+
]
+

+
[[package]]
name = "outref"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2380,6 +2474,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"

[[package]]
+
name = "plist"
+
version = "1.7.4"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "3af6b589e163c5a788fab00ce0c0366f6efbb9959c2f9874b224936af7fce7e1"
+
dependencies = [
+
 "base64 0.22.1",
+
 "indexmap",
+
 "quick-xml",
+
 "serde",
+
 "time",
+
]
+

+
[[package]]
name = "poly1305"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2427,6 +2534,12 @@ dependencies = [
]

[[package]]
+
name = "powerfmt"
+
version = "0.2.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
+

+
[[package]]
name = "ppv-lite86"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2515,6 +2628,15 @@ dependencies = [
]

[[package]]
+
name = "quick-xml"
+
version = "0.38.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "9845d9dccf565065824e69f9f235fafba1587031eda353c1f1561cd6a6be78f4"
+
dependencies = [
+
 "memchr",
+
]
+

+
[[package]]
name = "quote"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2524,6 +2646,12 @@ dependencies = [
]

[[package]]
+
name = "r-efi"
+
version = "5.3.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
+

+
[[package]]
name = "radicle"
version = "0.18.0"
dependencies = [
@@ -2571,6 +2699,7 @@ dependencies = [
 "anyhow",
 "chrono",
 "git-ref-format",
+
 "human-panic",
 "lexopt",
 "localtime",
 "log",
@@ -2889,7 +3018,7 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
-
 "getrandom",
+
 "getrandom 0.2.15",
]

[[package]]
@@ -3011,6 +3140,12 @@ dependencies = [
]

[[package]]
+
name = "rustc-demangle"
+
version = "0.1.26"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace"
+

+
[[package]]
name = "rustix"
version = "0.38.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3130,7 +3265,7 @@ checksum = "9110d660d39b5f65f10a978ce0dd5e0a08c50e1d5589cadfad9b9a5f221fdb14"
dependencies = [
 "base64 0.22.1",
 "errno",
-
 "getrandom",
+
 "getrandom 0.2.15",
 "libc",
]

@@ -3190,6 +3325,15 @@ dependencies = [
]

[[package]]
+
name = "serde_spanned"
+
version = "1.0.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83"
+
dependencies = [
+
 "serde",
+
]
+

+
[[package]]
name = "sha1_smol"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3619,6 +3763,37 @@ dependencies = [
]

[[package]]
+
name = "time"
+
version = "0.3.41"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40"
+
dependencies = [
+
 "deranged",
+
 "itoa",
+
 "num-conv",
+
 "powerfmt",
+
 "serde",
+
 "time-core",
+
 "time-macros",
+
]
+

+
[[package]]
+
name = "time-core"
+
version = "0.1.4"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c"
+

+
[[package]]
+
name = "time-macros"
+
version = "0.2.22"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49"
+
dependencies = [
+
 "num-conv",
+
 "time-core",
+
]
+

+
[[package]]
name = "timeago"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3650,6 +3825,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"

[[package]]
+
name = "toml"
+
version = "0.9.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "75129e1dc5000bfbaa9fee9d1b21f974f9fbad9daec557a521ee6e080825f6e8"
+
dependencies = [
+
 "serde",
+
 "serde_spanned",
+
 "toml_datetime",
+
 "toml_writer",
+
]
+

+
[[package]]
+
name = "toml_datetime"
+
version = "0.7.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3"
+
dependencies = [
+
 "serde",
+
]
+

+
[[package]]
+
name = "toml_writer"
+
version = "1.0.2"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "fcc842091f2def52017664b53082ecbbeb5c7731092bad69d2c63050401dfd64"
+

+
[[package]]
name = "tracing"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3941,6 +4143,9 @@ name = "uuid"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9"
+
dependencies = [
+
 "getrandom 0.3.3",
+
]

[[package]]
name = "uuid-simd"
@@ -3994,6 +4199,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"

[[package]]
+
name = "wasi"
+
version = "0.14.2+wasi-0.2.4"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
+
dependencies = [
+
 "wit-bindgen-rt",
+
]
+

+
[[package]]
name = "wasm-bindgen"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4326,6 +4540,15 @@ dependencies = [
]

[[package]]
+
name = "wit-bindgen-rt"
+
version = "0.39.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
+
dependencies = [
+
 "bitflags 2.9.1",
+
]
+

+
[[package]]
name = "write16"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
modified Cargo.toml
@@ -29,6 +29,7 @@ crossbeam-channel = "0.5.6"
cyphernet = "0.5.2"
fastrand = { version = "2.0.0", default-features = false }
git2 = { version = "0.19.0", default-features = false }
+
human-panic = "2"
lexopt = "0.3.0"
libc = "0.2.137"
localtime = "1.2.0"
modified crates/radicle-cli/Cargo.toml
@@ -17,6 +17,7 @@ path = "src/main.rs"
anyhow = { workspace = true }
chrono = { workspace = true, features = ["clock", "std"] }
git-ref-format = { version = "0.3.0", features = ["macro"] }
+
human-panic.workspace = true
lexopt = { workspace = true }
localtime = { workspace = true }
log = { workspace = true, features = ["std"] }
modified crates/radicle-cli/src/main.rs
@@ -29,6 +29,14 @@ enum Command {
}

fn main() {
+
    human_panic::setup_panic!(human_panic::Metadata::new(
+
        env!("CARGO_PKG_NAME"),
+
        env!("CARGO_PKG_VERSION")
+
    )
+
    .authors("The radicle Foundation")
+
    .homepage("radicle.xyz")
+
    .support("- Open a support request at https://radicle.zulipchat.com/ or file an issue via radicle itself"));
+

    if let Some(lvl) = radicle::logger::env_level() {
        let logger = Box::new(radicle::logger::Logger::new(lvl));
        log::set_boxed_logger(logger).expect("no other logger should have been set already");