Skip to content

Commit 5eb0ee0

Browse files
committed
fix: set version number from Cargo.toml in --help text
1 parent b97e45f commit 5eb0ee0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

aw-server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fern = { version = "0.6", features = ["colored"] }
2828
toml = "0.5"
2929
gethostname = "0.2"
3030
uuid = { version = "1.0", features = ["serde", "v4"] }
31-
clap = { version = "3.1", features = ["derive"] }
31+
clap = { version = "3.1", features = ["derive", "cargo"] }
3232

3333
aw-datastore = { path = "../aw-datastore" }
3434
aw-models = { path = "../aw-models" }

aw-server/src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ extern crate log;
44
use std::env;
55

66
use clap::Parser;
7+
use clap::crate_version;
78

89
use aw_server::*;
910

@@ -15,7 +16,7 @@ static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
1516

1617
/// Rust server for ActivityWatch
1718
#[derive(Parser)]
18-
#[clap(version = "0.10", author = "Johan Bjäreholt, Erik Bjäreholt")]
19+
#[clap(version = crate_version!(), author = "Johan Bjäreholt, Erik Bjäreholt, et al.")]
1920
struct Opts {
2021
/// Run in testing mode
2122
#[clap(long)]
@@ -48,11 +49,10 @@ async fn main() -> Result<(), rocket::Error> {
4849
use std::sync::Mutex;
4950

5051
let mut testing = opts.testing;
52+
5153
// Always override environment if --testing is specified
52-
if !testing {
53-
if cfg!(debug_assertions) {
54-
testing = true;
55-
}
54+
if !testing && cfg!(debug_assertions) {
55+
testing = true;
5656
}
5757

5858
logging::setup_logger(testing).expect("Failed to setup logging");

0 commit comments

Comments
 (0)