pace_time/
flags.rs

1use chrono::NaiveDate;
2
3#[cfg(feature = "clap")]
4use clap::{Args, ValueEnum};
5
6use getset::{Getters, MutGetters, Setters};
7use typed_builder::TypedBuilder;
8
9#[derive(Debug, Clone, Eq, PartialEq, Default)]
10#[cfg_attr(feature = "clap", derive(ValueEnum))]
11pub enum TimeFlags {
12    /// Show the reflection for the current day
13    #[default]
14    Today,
15
16    /// Show the reflection for the previous day
17    Yesterday,
18
19    /// Show the reflection for the current week
20    CurrentWeek,
21
22    /// Show the reflection for the previous week
23    LastWeek,
24
25    /// Show the reflection for the current month
26    CurrentMonth,
27
28    /// Show the reflection for the previous month
29    LastMonth,
30}
31
32#[derive(Debug, Getters, Default, TypedBuilder, Setters, MutGetters, Clone, Eq, PartialEq)]
33#[getset(get = "pub")]
34#[cfg_attr(feature = "clap", derive(Args))]
35#[cfg_attr(
36        feature = "clap", clap(group = clap::ArgGroup::new("date-flag").multiple(true)))]
37pub struct DateFlags {
38    /// Show the reflection for a specific date, mutually exclusive with `from` and `to`. Format: YYYY-MM-DD
39    #[cfg_attr(
40        feature = "clap",
41        clap(
42            long,
43            group = "date-flag",
44            value_name = "Specific Date",
45            exclusive = true
46        )
47    )]
48    #[builder(setter(strip_option))]
49    pub(crate) date: Option<NaiveDate>,
50
51    /// Start date for the reflection period. Format: YYYY-MM-DD
52    #[cfg_attr(
53        feature = "clap",
54        clap(long, group = "date-flag", value_name = "Start Date")
55    )]
56    #[builder(setter(strip_option))]
57    pub(crate) from: Option<NaiveDate>,
58
59    /// End date for the reflection period. Format: YYYY-MM-DD
60    #[cfg_attr(
61        feature = "clap",
62        clap(long, group = "date-flag", value_name = "End Date")
63    )]
64    #[builder(setter(strip_option))]
65    pub(crate) to: Option<NaiveDate>,
66}