Fix status and history output: empty JSON, empty tags, unreachable branch #10

Open
opened 2026-08-17 19:31:25 +00:00 by rosa · 0 comments
Owner

What to build

Three output defects, all in how the current status and the history are printed.

Empty history prints nothing in JSON mode. tomate history --json returns early when the history file does not exist, before it reaches the JSON branch, so a script gets an empty stream instead of parseable JSON. Loading the history already handles a missing file by returning an empty history, so the early return is both redundant and wrong.

$ tomate history --json     # with no history file
(no output)

Tags are always set, even when none were given. Starting a Pomodoro stores the tag list unconditionally, so a Pomodoro with no tags carries an empty list rather than no list at all. The status output then prints a bare Tags: header with nothing beneath it, and the history table's - placeholder for untagged Pomodoros can never appear.

$ tomate pom start "no tags given"
Current Pomodoro: no tags given
...
Tags:
              <- nothing here

An unreachable branch in status printing. The Active arm re-tests the format option that the function already handled and returned for, so that branch can never run. Remove it.

Acceptance criteria

  • tomate history --json prints valid JSON representing an empty history when no history file exists, and exits 0
  • A Pomodoro started with no --tag arguments stores no tag list, and tomate status omits the Tags: header entirely for it
  • tomate history shows the - placeholder in the Tags column for a Pomodoro that has no tags
  • A Pomodoro started with tags is unaffected in both the status output and the history table
  • The unreachable format branch in the active-Pomodoro status arm is gone

Blocked by

None — can start immediately.

## What to build Three output defects, all in how the current status and the history are printed. **Empty history prints nothing in JSON mode.** `tomate history --json` returns early when the history file does not exist, before it reaches the JSON branch, so a script gets an empty stream instead of parseable JSON. Loading the history already handles a missing file by returning an empty history, so the early return is both redundant and wrong. ``` $ tomate history --json # with no history file (no output) ``` **Tags are always set, even when none were given.** Starting a Pomodoro stores the tag list unconditionally, so a Pomodoro with no tags carries an empty list rather than no list at all. The status output then prints a bare `Tags:` header with nothing beneath it, and the history table's `-` placeholder for untagged Pomodoros can never appear. ``` $ tomate pom start "no tags given" Current Pomodoro: no tags given ... Tags: <- nothing here ``` **An unreachable branch in status printing.** The `Active` arm re-tests the format option that the function already handled and returned for, so that branch can never run. Remove it. ## Acceptance criteria - [ ] `tomate history --json` prints valid JSON representing an empty history when no history file exists, and exits 0 - [ ] A Pomodoro started with no `--tag` arguments stores no tag list, and `tomate status` omits the `Tags:` header entirely for it - [ ] `tomate history` shows the `-` placeholder in the Tags column for a Pomodoro that has no tags - [ ] A Pomodoro started with tags is unaffected in both the status output and the history table - [ ] The unreachable format branch in the active-Pomodoro status arm is gone ## Blocked by None — can start immediately.
Sign in to join this conversation.
No description provided.