Skip to content

Commit

Permalink
fix: set version number from Cargo.toml in --help text
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Jun 8, 2022
1 parent b97e45f commit 5eb0ee0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion aw-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fern = { version = "0.6", features = ["colored"] }
toml = "0.5"
gethostname = "0.2"
uuid = { version = "1.0", features = ["serde", "v4"] }
clap = { version = "3.1", features = ["derive"] }
clap = { version = "3.1", features = ["derive", "cargo"] }

aw-datastore = { path = "../aw-datastore" }
aw-models = { path = "../aw-models" }
Expand Down
10 changes: 5 additions & 5 deletions aw-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extern crate log;
use std::env;

use clap::Parser;
use clap::crate_version;

use aw_server::*;

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

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

let mut testing = opts.testing;

// Always override environment if --testing is specified
if !testing {
if cfg!(debug_assertions) {
testing = true;
}
if !testing && cfg!(debug_assertions) {
testing = true;
}

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

0 comments on commit 5eb0ee0

Please sign in to comment.