You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.9 KiB

+++ title = "nbd archive command and Closed status" priority = 6 status = "done" ticket_type = "feature" dependencies = [] +++ Add Status::Closed (serialised as "closed") and a convenience nbd archive <id> command that sets it.

Motivation

done tickets clutter nbd list. closed provides a soft-delete: the ticket is preserved on disk but excluded from normal listings by default.

Approach

ticket.rs

  • Add Closed variant to Status enum (after Done).
  • #[serde(rename_all = "snake_case")] already handles serialisation → "closed".

main.rs

  • Update parse_status to accept "closed".
  • Update status_str in display.rs to map Status::Closed"closed".
  • Add Archive variant to Commands:
    Archive { id: String }
    
  • Implement cmd_archive(id, json): read ticket → set status to Closed → write → print. This is syntactic sugar for nbd update <id> --status closed.

display.rs

  • Add "closed" to status_str match arm.

list filtering

  • nbd list currently shows all tickets. After this change, it should by default hide Closed tickets.
  • Add a --all flag to nbd list to show all tickets including closed ones.
  • Update list_tickets or filter at the command handler level. Prefer filtering in cmd_list to keep list_tickets generic.

Tests

  • Unit test: Status::Closed serialises to "closed" and back.
  • Integration test: nbd archive <id> sets status to closed.
  • Integration test: nbd list does not show closed tickets.
  • Integration test: nbd list --all shows closed tickets.

Files touched

  • src/ticket.rs — add Closed variant
  • src/main.rsArchive command, parse_status update, --all flag on list
  • src/display.rsstatus_str update
  • src/tests.rs — unit tests
  • tests/integration.rs — integration tests
  • README.md — document archive and --all