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.

44 lines
1.4 KiB
Markdown

+++
title = "Add next <type> filtered sub-commands (next bug, next feature, next task)"
priority = 4
status = "todo"
ticket_type = "feature"
dependencies = []
+++
## Problem
`nbd next --filter type=bug` is verbose. When an engineer wants the highest-priority ready bug, they should be able to say `nbd next bug`.
## Sub-commands to add (positional arg to `next`)
Accept an optional positional `<type>` argument to `nbd next`:
```sh
nbd next feature # equivalent to: nbd next --filter type=feature
nbd next task # equivalent to: nbd next --filter type=task
nbd next bug # equivalent to: nbd next --filter type=bug
nbd next project # equivalent to: nbd next --filter type=project
```
## Implementation
**`src/main.rs`** — `Commands::Next`
Add an optional positional argument `ticket_type` to the `Next` variant:
```rust
Next {
ticket_type: Option<String>, // new: positional shorthand
filter: Vec<String>,
}
```
In `cmd_next`, when `ticket_type` is `Some(t)`:
- Validate it is one of `project`, `feature`, `task`, `bug` (return an error otherwise)
- Prepend `format!("type={t}")` to the effective filter list before calling `parse_filters`
Explicit `--filter type=...` values are ORed with the positional shorthand, consistent with `TicketFilter` behaviour.
**`tests/integration.rs`**
Add tests verifying that `next bug` returns only bug-type ready tickets and that `next` with no argument still works as before.