(d637288) Add campaign set, and bump to 0.21.0

`campaign add --codename` was the only writer of the field, so a campaign
already on the board could not be given one without editing the file by
hand -- which is every campaign filed before 0.20.0.

A `campaign set`, not a flag on something narrower: the file has more than
one editable thing, and the moment somebody wants to fix a typo in a title
there would be a second command to design. It carries `--title`, which
renames the file the way `set --title` does, and `--codename`, through the
same parser `campaign add` takes. Built out of `set`'s own parts --
`set_title`, `apply`, `report`, and the whole-file no-op comparison -- so
nothing about writing a field lives twice.

The codename goes through `set_or_insert_metadata_field` rather than
`set_metadata_field`: a campaign filed before the field existed has no such
line, and those are exactly the campaigns this is for. That exposed a
second thing -- `Codename` was not in `METADATA_ORDER`, so an inserted line
landed at the end of the block while `campaign_body` writes it under the
ID, two shapes of one file. It is in the list now, directly after ID.

`save_ticket` split into `save_entry` with `save_ticket` and
`save_campaign` as named wrappers, so a campaign gets the same write-then-
rename a ticket has rather than a second copy of it. `write_then_replace`
and `find_entry_file` take the noun, so a failure says "campaign" where it
is one.

No `--description`, filed as 32e98ab: `set` and `append` are a pair for a
prose section, and replacing a description with no way to add a paragraph
is the half that loses the rest of it. No `--owner` and no `--clear`, each
for a reason recorded on the ticket.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ansho Rei
2026-08-23 12:22:59 +02:00
co-authored by Claude Opus 5
parent 528566d103
commit 72dbdec2ec
12 changed files with 463 additions and 33 deletions
+6 -6
View File
@@ -50,11 +50,11 @@ pub const CAMPAIGN_COMMANDS: [&str; 1] = ["assign"];
/// Nested subcommands whose first argument is a campaign, as `parent child`.
///
/// `campaign show` is the only one, and it is why the fish half needs a third position
/// helper: its argument is the *third* token, where `__worklane_first_arg_of` reads the
/// second and `__worklane_second_arg_of` counts a top-level command's arguments. Neither
/// can tell `campaign show <TAB>` from `chown alice <TAB>` by position.
pub const CAMPAIGN_NESTED_COMMANDS: [(&str, &str); 1] = [("campaign", "show")];
/// `campaign show` and `campaign set`, and they are why the fish half needs a third
/// position helper: their argument is the *third* token, where `__worklane_first_arg_of`
/// reads the second and `__worklane_second_arg_of` counts a top-level command's arguments.
/// Neither can tell `campaign show <TAB>` from `chown alice <TAB>` by position.
pub const CAMPAIGN_NESTED_COMMANDS: [(&str, &str); 2] = [("campaign", "show"), ("campaign", "set")];
/// Options whose value is a campaign.
pub const CAMPAIGN_FLAGS: [&str; 1] = ["campaign"];
@@ -348,7 +348,7 @@ mod tests {
// A guard on the walker itself: if it stopped finding arguments, every assertion
// above would pass by never running.
assert_eq!(seen, 3, "expected assign, campaign show and ls --campaign");
assert_eq!(seen, 4, "expected assign, campaign show, campaign set and ls --campaign");
}
/// Tags have their own list because their values come from `worklane tags` rather than