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.
49 lines
1.5 KiB
Markdown
49 lines
1.5 KiB
Markdown
+++
|
|
title = "Add list status sub-commands (list todo, list backlog, etc.)"
|
|
priority = 4
|
|
status = "todo"
|
|
ticket_type = "feature"
|
|
dependencies = []
|
|
+++
|
|
## Problem
|
|
|
|
Filtering by status requires the verbose `--filter status=X`. Common patterns like listing only backlog or only completed tickets should have ergonomic shortcuts.
|
|
|
|
## Sub-commands to add (positional arg to `list`)
|
|
|
|
Accept an optional positional `<status>` argument to `nbd list`:
|
|
|
|
```sh
|
|
nbd list backlog # equivalent to: nbd list --filter status=backlog
|
|
nbd list closed # equivalent to: nbd list --filter status=closed
|
|
nbd list completed # equivalent to: nbd list --filter status=done
|
|
nbd list todo # equivalent to: nbd list --filter status=todo
|
|
nbd list in_progress # equivalent to: nbd list --filter status=in_progress
|
|
```
|
|
|
|
Note: `completed` is an alias for `done` (avoids the awkward `nbd list done`).
|
|
|
|
## Implementation
|
|
|
|
**`src/main.rs`** — `Commands::List`
|
|
|
|
Add an optional positional argument `status` to the `List` variant:
|
|
|
|
```rust
|
|
List {
|
|
status: Option<String>, // new: positional shorthand
|
|
filter: Vec<String>,
|
|
all: bool,
|
|
}
|
|
```
|
|
|
|
In `cmd_list`, when `status` is `Some(s)`:
|
|
- Map `"completed"" → "done"`, others pass through
|
|
- Treat it as if the caller had passed `--filter status=<s>`
|
|
- The explicit `--filter` and `--all` flags should still override as today
|
|
|
|
If both `status` and `--filter status=...` are given, merge them (OR behaviour within the status group, consistent with `TicketFilter`).
|
|
|
|
**`tests/integration.rs`**
|
|
|
|
Add tests for each status shorthand. |