From 59d428ecdc2d89bfa9199c439a44a45ae9526bd6 Mon Sep 17 00:00:00 2001 From: Jonas Lima de Amorim Date: Thu, 23 Jul 2026 18:44:19 -0300 Subject: [PATCH] feat(add): default --date to today when omitted --- README.md | 6 +++--- Timetracker.Console/Options/AddOptions.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ac59086..b8a525d 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ Create a new time entry. | Option | Short | Required | Description | |---|---|---|---| -| `--date` | `-d` | yes | Date: `YYYY/MM/DD`, `today`, or `yesterday` | +| `--date` | `-d` | no | Date: `YYYY/MM/DD`, `today`, or `yesterday` (default: today) | | `--work-item` | `-w` | yes | Work Item ID | | `--length` | `-l` | yes | Duration in hours (e.g. `0.5`, `1.5`) | | `--type` | `-t` | yes | Activity type name (see `activities`) | @@ -129,8 +129,8 @@ Create a new time entry. | `--dry-run` | | no | Preview the entry locally without submitting | ```bash -# Log 2 hours of development on today -timetracker add -d today -w 12345 -l 2 -t Development -c "Feature X" +# Log 2 hours of development today (date defaults to today) +timetracker add -w 12345 -l 2 -t Development -c "Feature X" # Log half an hour of a meeting starting at 14:00 timetracker add -d 2026/06/19 -w 12345 -l 0.5 -t Meeting -h 14:00 diff --git a/Timetracker.Console/Options/AddOptions.cs b/Timetracker.Console/Options/AddOptions.cs index bff3c74..c7ced31 100644 --- a/Timetracker.Console/Options/AddOptions.cs +++ b/Timetracker.Console/Options/AddOptions.cs @@ -5,7 +5,7 @@ namespace Timetracker.Options; [Verb("add", HelpText = "Add a new activity directly to the server.")] public class AddOptions { - [Option('d', "date", Required = true, HelpText = "Specify the date for the activity in the format YYYY/MM/DD (e.g., 2025/12/31).")] + [Option('d', "date", Required = false, Default = "today", HelpText = "Date for the activity: YYYY/MM/DD (e.g., 2025/12/31), 'today' or 'yesterday'. Defaults to today.")] public string ActivityDate { get; set; } [Option('w', "work-item", Required = true, HelpText = "Specify the Work Item ID associated with the activity.")]