(74904dc) Let a ticket field be cleared back to unset, and bump to 0.18.0

`set --clear <field>` is the one way to take a value away, repeatable, with
the field as a `ValueEnum` value: an unknown one is a usage error listing the
six that are not, and the shells complete them for free. Not a per-field
`--clear-due`, which is a flag per field to keep in step with the one it
undoes, and not an empty value, which is already a paragraph break for a
section and would make an accidentally empty variable a silent delete.

What goes back is what `add` writes for a field it was never given, through
the new `NOT_SET` and `NONE` constants and each section's placeholder, so a
cleared ticket and one filed without the field read the same. Sections are in
scope and go back through `clear_section_body` rather than
`set_section_body`: the latter runs its items through `Section::render`, which
would have written `- [ ] _No acceptance criteria provided._`.

Owner is `chown --clear <ticket>`, so the field keeps its one writer. The flag
carries the ticket because the ticket is chown's second positional and a bare
flag would land it in the user's slot for the handler to read back out, which
is hand-parsing what clap can state. It writes `_Not set_` rather than the git
user: `add` falls back to the git user because it is filing something new, and
an owner taken away says nobody owns this.

The empty-value error split in two rather than being reworded. `non_empty`
says only that the value cannot be empty, for the arguments with no empty
form; `clearable` names `--clear`, for the arguments whose field has one. One
message for both would have lied about `ls --tag`.

Replacing and clearing one field in a single call is refused rather than
resolved by whichever was applied last, and cleared fields are reported as
`Cleared due on '...'` beside `Updated priority on '...'`, since one list
would say `Updated` of a field that was emptied.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ansho Rei
2026-08-23 00:04:28 +02:00
co-authored by Claude Opus 5
parent 175c1d016d
commit cc5f9b8a46
15 changed files with 810 additions and 92 deletions
+5 -3
View File
@@ -530,9 +530,10 @@ fn add_refuses_an_unpadded_due_date_rather_than_padding_it() {
}
/// An empty value keeps the message about clearing, since that is what somebody typing
/// it is reaching for.
/// it is reaching for. On `add` the answer is to omit the flag, but the message names
/// `--clear` because the same parser guards `set --due`, where that is the answer.
#[test]
fn an_empty_due_date_says_clearing_is_not_supported() {
fn an_empty_due_date_points_at_clear() {
let temp = TempDir::new().unwrap();
setup_worklane(&temp);
@@ -549,7 +550,8 @@ fn an_empty_due_date_says_clearing_is_not_supported() {
)
.to_string();
assert!(stderr.contains("clearing a field is not supported"), "{stderr}");
assert!(stderr.contains("use --clear"), "{stderr}");
assert!(!stderr.contains("not supported"), "{stderr}");
}
fn read_only_ticket(dir: &Path) -> String {