Skip to content

Commit

Permalink
the status subcommand now returns an exit code, depending on if the
Browse files Browse the repository at this point in the history
time tracking is currently active or not.
  • Loading branch information
hardliner66 committed Apr 13, 2021
1 parent 880e973 commit 731b0ad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
edition = "2018"
license-file = "LICENSE"
Expand Down
4 changes: 3 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -402,6 +403,7 @@ fn status(data: &[TrackingEvent]) {
time.second()
);
}
std::process::exit(iif!(active, 0, -1));
}
}

Expand Down

0 comments on commit 731b0ad

Please sign in to comment.