Skip to content

feat: add --until, today/yesterday keywords; harmonize date flags - #17

Merged
DTTerastar merged 1 commit into
mainfrom
feat/until-flag-and-keyword-dates
Apr 25, 2026
Merged

feat: add --until, today/yesterday keywords; harmonize date flags#17
DTTerastar merged 1 commit into
mainfrom
feat/until-flag-and-keyword-dates

Conversation

@DTTerastar

Copy link
Copy Markdown
Collaborator

Summary

Part 1 of 3 in a cross-repo date-flag harmonization across the quantcli export CLIs (crono / liftoff / withings). Liftoff already had `--since` with relative + absolute values; this PR extends it to:

  • Accept `today` and `yesterday` as values (previously only the `workouts show` argument supported these keywords).
  • Add a matching `--until VALUE` flag that is inclusive of the named day.
  • Use a single shared `parseDateValue` helper for `--since`, `--until`, and `workouts show ` so all three accept the same vocabulary.

```
--since VALUE inclusive lower bound
--until VALUE inclusive upper bound (new)
VALUE: today | yesterday | YYYY-MM-DD | Nd/Nw/Nm/Ny
```

One semantic change worth flagging

`--since 30d` previously meant "30 days ago at this exact moment" (`time.Now().AddDate(0,0,-30)`). It now means "midnight of the day 30 calendar days ago". Same as how `--since 2025-01-01` already worked. Matches user intent better — running the same command at 11:59pm vs 12:01am should not return different windows.

Test plan

  • `go build ./...` and `go vet ./...` pass
  • `workouts list --since yesterday --until today` returns yesterday's workout
  • `workouts show today` correctly reports no workout when today is empty
  • `workouts list --since 3d --until 2026-04-21` works (empty window when ranges don't overlap, as expected)
  • Reviewer: confirm `bodyweights list --since 6m --until 1m` returns a sensible historical window

Follow-ups

  • crono-export-cli: needs the bigger refactor — `--today`/`--days`/`--start`/`--end` removed in favor of `--since`/`--until`.
  • withings-export-cli: same shape as this PR.

🤖 Generated with Claude Code

Unifies the date-flag vocabulary across this CLI's subcommands and aligns
with the same vocabulary being adopted by crono-export and withings-export.

  --since VALUE   inclusive lower bound
  --until VALUE   inclusive upper bound (new)

  VALUE: today | yesterday | YYYY-MM-DD | Nd/Nw/Nm/Ny

The window is half-open internally — --until 2026-04-15 expands to "up to
and including all of 2026-04-15" by adding 24h before filtering.

Side effect: relative durations now snap to local midnight. --since 30d
previously meant "30 days ago at this exact moment", which made the same
command return slightly different results depending on the time of day.
It now means "midnight of the day 30 calendar days ago", which matches
how absolute dates already worked and how users actually think about
"the last 30 days".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant