From 3620617df184a99f9ac3f79c9a2361b4debd3ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Arg=C3=A9rus?= Date: Mon, 8 Apr 2024 08:20:39 +0200 Subject: [PATCH] Fix `--help` in clap This functionality was broken by "f38363d - Switch to 2021 edition of Rust", or more specifically with the change to resolver = 2. The `--help` flag requires a feature in clap to be enabled, which is either a newly introduced requirement, or the feature(s) were somehow included implicitly when using resolver = 1. --- databroker-cli/Cargo.toml | 3 +++ databroker/Cargo.toml | 4 +++- databroker/src/main.rs | 5 ++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/databroker-cli/Cargo.toml b/databroker-cli/Cargo.toml index 389c8f96..b89003a8 100644 --- a/databroker-cli/Cargo.toml +++ b/databroker-cli/Cargo.toml @@ -39,6 +39,9 @@ clap = { workspace = true, features = [ "std", "env", "derive", + "help", + "error-context", + "usage", ] } regex = "1.6.0" http = "0.2.8" diff --git a/databroker/Cargo.toml b/databroker/Cargo.toml index 6ab89b49..9e38cf45 100644 --- a/databroker/Cargo.toml +++ b/databroker/Cargo.toml @@ -45,7 +45,9 @@ tracing-subscriber = { version = "0.3.11", default-features = false, features = clap = { workspace = true, features = [ "std", "env", - "derive", + "help", + "usage", + "error-context", ] } sqlparser = "0.16.0" serde = { version = "1.0", features = ["derive"] } diff --git a/databroker/src/main.rs b/databroker/src/main.rs index 91c0fe15..3b262f0d 100644 --- a/databroker/src/main.rs +++ b/databroker/src/main.rs @@ -171,8 +171,7 @@ async fn read_metadata_file<'a, 'b>( #[tokio::main] async fn main() -> Result<(), Box> { - let version = option_env!("VERGEN_GIT_SEMVER_LIGHTWEIGHT") - .unwrap_or(option_env!("VERGEN_GIT_SHA").unwrap_or("unknown")); + let version = option_env!("CARGO_PKG_VERSION").unwrap_or_default(); let about = format!( concat!( @@ -190,7 +189,7 @@ async fn main() -> Result<(), Box> { option_env!("VERGEN_CARGO_DEBUG").unwrap_or(""), ); - let mut parser = Command::new("Kuksa Data Broker"); + let mut parser = Command::new("Kuksa Databroker"); parser = parser .version(version) .about(about)