feat(activity): print the chart and the Days table of an activity command #306

Merged
kfickel merged 6 commits from 280_print-activity-chart into main 2026-10-20 14:36:33 +02:00
Collaborator

Closes #280. Part of #277.

streamd <key> [RANGE] of an activity command now prints its activity instead of not implemented yet.

Command line (commands/activity/cli.rs)

  • RANGE takes one or more words, joined and parsed with the syntax of #279 (streamd sport last 30 days). Without one it shows the month of today. A wrong range is a usage error (exit 2) that names the forms.
  • --exclude-mixed / --include-mixed override exclude_mixed and conflict with each other.
  • streamd <key> shards [RANGE] lists the matching shards, newest first. It uses args_conflicts_with_subcommands. clap then reads streamd sport -i shards as a range word, so that case gets its own message: `shards` takes no options.
  • -i hands the range and the flags to the view through ViewOptions. The placeholder view keeps them (and shows them in its context line) for #281.

Output (commands/activity/print.rs, pure, golden-tested)

  • Calendar (2–42 days), grid (more days, and all: one strip per calendar year, newest first) and day (the day's shards with time, title, tags and file:line), chosen by Shape.
  • Then the legend, the totals and the Days table, inclusive or exclusive.
  • Glyphs ░▒▓█ / ◩ / · / ┄ / blank. The series colours are truecolor; today is bold and underlined. Colour is used only on a terminal without NO_COLOR (styled_output, moved to commands/state/style.rs so both commands share it).
  • A shard that matches two series gets a warning on stderr after the output, for both the chart and shards.

Core

  • Stats.series_only_shards: the shards of each series on its days alone, for the shards column of the exclusive table.

Docs

R36 (command line, output) and R30 (the flags of -i), README (usage with the example), AGENTS.md.

nix flake check passes.

Closes #280. Part of #277. `streamd <key> [RANGE]` of an activity command now prints its activity instead of `not implemented yet`. ## Command line (`commands/activity/cli.rs`) - `RANGE` takes one or more words, joined and parsed with the syntax of #279 (`streamd sport last 30 days`). Without one it shows the month of today. A wrong range is a usage error (exit 2) that names the forms. - `--exclude-mixed` / `--include-mixed` override `exclude_mixed` and conflict with each other. - `streamd <key> shards [RANGE]` lists the matching shards, newest first. It uses `args_conflicts_with_subcommands`. clap then reads `streamd sport -i shards` as a range word, so that case gets its own message: `` `shards` takes no options ``. - `-i` hands the range and the flags to the view through `ViewOptions`. The placeholder view keeps them (and shows them in its context line) for #281. ## Output (`commands/activity/print.rs`, pure, golden-tested) - **Calendar** (2–42 days), **grid** (more days, and `all`: one strip per calendar year, newest first) and **day** (the day's shards with time, title, tags and `file:line`), chosen by `Shape`. - Then the legend, the totals and the Days table, inclusive or exclusive. - Glyphs `░▒▓█` / `◩` / `·` / `┄` / blank. The series colours are truecolor; today is bold and underlined. Colour is used only on a terminal without `NO_COLOR` (`styled_output`, moved to `commands/state/style.rs` so both commands share it). - A shard that matches two series gets a warning on stderr after the output, for both the chart and `shards`. ## Core - `Stats.series_only_shards`: the shards of each series on its days alone, for the shards column of the exclusive table. ## Docs R36 (command line, output) and R30 (the flags of `-i`), README (usage with the example), AGENTS.md. `nix flake check` passes.
kfickel deleted branch 280_print-activity-chart 2026-10-20 14:36:34 +02:00
Sign in to join this conversation.
No reviewers
No labels
android
cli
epic
planned
tui
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
kfickel/streamd!306
No description provided.