From 731b0ad640afa55e7faabef3d0797e15d4c585ee Mon Sep 17 00:00:00 2001 From: hardliner66 Date: Tue, 13 Apr 2021 15:20:52 +0200 Subject: [PATCH] the status subcommand now returns an exit code, depending on if the time tracking is currently active or not. --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d38492..a899411 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -445,7 +445,7 @@ dependencies = [ [[package]] name = "timetracking" -version = "1.4.1-alpha.0" +version = "1.4.1" dependencies = [ "bincode", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 5044715..d9056b8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "timetracking" description = "Simple time tracker with simple data format" -version = "1.4.1-alpha.0" +version = "1.4.1" authors = ["hardliner66 "] edition = "2018" license-file = "LICENSE" diff --git a/src/main.rs b/src/main.rs index 1e82966..cfd568f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,7 +21,8 @@ struct Options { #[derive(Debug, StructOpt)] enum Command { - /// show info from the latest entry + /// show info from the latest entry. Returns the exit code 0, if the time tracking is currently + /// active and -1 if not. Status, /// start time tracking @@ -402,6 +403,7 @@ fn status(data: &[TrackingEvent]) { time.second() ); } + std::process::exit(iif!(active, 0, -1)); } }