Skip to content

Commit

Permalink
feat: add timezone args also to other commands
Browse files Browse the repository at this point in the history
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
  • Loading branch information
simonsan committed Mar 19, 2024
1 parent c637986 commit ed2eab6
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/core/src/commands/begin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub struct BeginCommandOptions {
)]
time_zone: Option<Tz>,

/// Time zone to use for the activity, e.g., "Europe/Amsterdam"
/// Time zone offset to use for the activity, e.g., "+0200" or "-0500". Format: ±HHMM
#[cfg_attr(
feature = "clap",
clap(long, value_name = "Time Zone Offset", visible_alias = "tzo")
Expand Down
15 changes: 15 additions & 0 deletions crates/core/src/commands/end.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use chrono_tz::Tz;
#[cfg(feature = "clap")]
use clap::Parser;
use getset::Getters;
Expand Down Expand Up @@ -26,6 +27,20 @@ pub struct EndCommandOptions {
)]
// FIXME: We should directly parse that into PaceTime or PaceNaiveDateTime
at: Option<String>,

/// Time zone to use for the activity, e.g., "Europe/Amsterdam"
#[cfg_attr(
feature = "clap",
clap(long, value_name = "Time Zone", visible_alias = "tz")
)]
time_zone: Option<Tz>,

/// Time zone offset to use for the activity, e.g., "+0200" or "-0500". Format: ±HHMM
#[cfg_attr(
feature = "clap",
clap(long, value_name = "Time Zone Offset", visible_alias = "tzo")
)]
time_zone_offset: Option<i32>,
}

impl EndCommandOptions {
Expand Down
15 changes: 15 additions & 0 deletions crates/core/src/commands/hold.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use chrono_tz::Tz;
#[cfg(feature = "clap")]
use clap::Parser;

Expand Down Expand Up @@ -37,6 +38,20 @@ pub struct HoldCommandOptions {
/// This is useful, if you want to also track the purpose of an interruption to an activity.
#[cfg_attr(feature = "clap", clap(long, visible_alias = "new"))]
new_if_exists: bool,

/// Time zone to use for the activity, e.g., "Europe/Amsterdam"
#[cfg_attr(
feature = "clap",
clap(long, value_name = "Time Zone", visible_alias = "tz")
)]
time_zone: Option<Tz>,

/// Time zone offset to use for the activity, e.g., "+0200" or "-0500". Format: ±HHMM
#[cfg_attr(
feature = "clap",
clap(long, value_name = "Time Zone Offset", visible_alias = "tzo")
)]
time_zone_offset: Option<i32>,
}

impl HoldCommandOptions {
Expand Down
15 changes: 15 additions & 0 deletions crates/core/src/commands/resume.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use chrono_tz::Tz;
#[cfg(feature = "clap")]
use clap::Parser;

Expand All @@ -22,6 +23,20 @@ pub struct ResumeCommandOptions {
#[cfg_attr(feature = "clap", clap(short, long))]
#[getset(get = "pub")]
list: bool,

/// Time zone to use for the activity, e.g., "Europe/Amsterdam"
#[cfg_attr(
feature = "clap",
clap(long, value_name = "Time Zone", visible_alias = "tz")
)]
time_zone: Option<Tz>,

/// Time zone offset to use for the activity, e.g., "+0200" or "-0500". Format: ±HHMM
#[cfg_attr(
feature = "clap",
clap(long, value_name = "Time Zone Offset", visible_alias = "tzo")
)]
time_zone_offset: Option<i32>,
}

impl ResumeCommandOptions {
Expand Down

0 comments on commit ed2eab6

Please sign in to comment.