Skip to content

Add a count command that prints the number of pending tasks #1

Description

@recklessop

Context

list shows all tasks, but there's no quick way to answer "how much do I still have to do?" without eyeballing the checkbox characters. count gives you the answer in one number, which is useful for scripting and for a fast sanity check before starting a work session.

Behavior

$ python3 cli.py count
3 pending

Reads from tasks.json. Doesn't write. Exits 0 on success.

Acceptance criteria

  • python3 cli.py count prints <N> pending where N excludes tasks marked done.
  • Empty list prints 0 pending, exits 0.
  • Usage line includes count alongside add | list | done.
  • New tests in tests/test_tasks.py cover: none pending, some pending, all done.
  • No dependency additions (stdlib only).

Not in scope

  • Category filters, tags, or due-date filtering. Just the count.
  • Coloring the output. Plain text only.

Files that may change

  • tasks.py — add count_pending(self) -> int, reusing the existing pending() helper.
  • cli.py — add elif command == "count": branch and update the usage string.
  • tests/test_tasks.py — new test cases for the three scenarios above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-readyScoped, contextual, and unambiguous enough for either a human or an agent to pick upenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions