Commit 638ef73
cli: collapse --tag provided/value signals into one in browsers update (#186)
## Summary
`tagsFromFlag` now reports whether the `--tag` flag was *provided*
(independent of whether its values parsed), so `runBrowsersUpdate` no
longer rebuilds that signal via `cmd.Flags().Changed("tag")` —
`BrowsersUpdateInput.SetTags` is renamed to `TagsProvided` and sourced
from the helper, with the three other call sites discarding the new
bool. This is a behavior-preserving structural cleanup (non-blocking
follow-up to #184) that leaves the `--name`/`--clear-name` side
untouched, since it has no equivalent redundancy. Two helper tests were
added to pin the newly-distinguished "absent" vs.
"provided-but-all-malformed" states.
## Test plan
- [x] `go build ./...`, `go vet ./cmd/`, `gofmt -l` clean
- [x] `go test ./...` green (incl. `TestBrowsersUpdate_*`,
`TestTagsFromFlag_*`, `TestParseKeyValueSpecs`)
- [x] CLI smoke: `--tag foo` → "No valid --tag KEY=VALUE pairs
provided"; `--tag foo --clear-tags` → "Cannot specify both --tag and
--clear-tags"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> CLI-only flag parsing refactor with regression tests; intended to
preserve browsers update validation behavior.
>
> **Overview**
> **`tagsFromFlag`** now returns parsed tags plus a **`provided`** bool
from `pflag`’s `Changed`, so an empty `--tag=` still counts as the user
passing `--tag` (not a silent no-op).
>
> **`browsers update`** wires that bool into
**`BrowsersUpdateInput.TagsProvided`** (replacing **`SetTags`** and
duplicate `Changed("tag")` in the runner). Validation for conflicting
**`--clear-tags`**, all-malformed tags, and lone empty **`--tag`** still
keys off “flag was provided,” not only a non-empty map.
>
> List/create/acquire call sites adopt the new two-value return and
ignore **`provided`**. Tests add **`tagsCmdWithArgs`** and cases for
absent flag, all-malformed, and empty **`--tag=`**.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
282203a. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 2c06a2c commit 638ef73
3 files changed
Lines changed: 89 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
742 | 742 | | |
743 | 743 | | |
744 | 744 | | |
745 | | - | |
| 745 | + | |
746 | 746 | | |
747 | 747 | | |
748 | 748 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
220 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
221 | 227 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | 228 | | |
226 | 229 | | |
227 | 230 | | |
228 | 231 | | |
229 | 232 | | |
230 | | - | |
| 233 | + | |
231 | 234 | | |
232 | | - | |
| 235 | + | |
233 | 236 | | |
234 | 237 | | |
235 | 238 | | |
| |||
302 | 305 | | |
303 | 306 | | |
304 | 307 | | |
305 | | - | |
| 308 | + | |
306 | 309 | | |
307 | 310 | | |
308 | 311 | | |
| |||
708 | 711 | | |
709 | 712 | | |
710 | 713 | | |
711 | | - | |
712 | | - | |
| 714 | + | |
| 715 | + | |
713 | 716 | | |
714 | | - | |
| 717 | + | |
715 | 718 | | |
716 | 719 | | |
717 | 720 | | |
718 | 721 | | |
719 | 722 | | |
720 | | - | |
| 723 | + | |
721 | 724 | | |
722 | 725 | | |
723 | 726 | | |
| |||
2761 | 2764 | | |
2762 | 2765 | | |
2763 | 2766 | | |
2764 | | - | |
| 2767 | + | |
2765 | 2768 | | |
2766 | 2769 | | |
2767 | 2770 | | |
| |||
2814 | 2817 | | |
2815 | 2818 | | |
2816 | 2819 | | |
2817 | | - | |
| 2820 | + | |
2818 | 2821 | | |
2819 | 2822 | | |
2820 | 2823 | | |
| |||
2986 | 2989 | | |
2987 | 2990 | | |
2988 | 2991 | | |
2989 | | - | |
| 2992 | + | |
2990 | 2993 | | |
2991 | 2994 | | |
2992 | 2995 | | |
| |||
3005 | 3008 | | |
3006 | 3009 | | |
3007 | 3010 | | |
3008 | | - | |
| 3011 | + | |
3009 | 3012 | | |
3010 | 3013 | | |
3011 | 3014 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
696 | 708 | | |
697 | 709 | | |
698 | 710 | | |
699 | | - | |
700 | | - | |
| 711 | + | |
701 | 712 | | |
702 | | - | |
| 713 | + | |
703 | 714 | | |
| 715 | + | |
704 | 716 | | |
705 | 717 | | |
706 | 718 | | |
707 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
708 | 757 | | |
709 | 758 | | |
710 | 759 | | |
| |||
2239 | 2288 | | |
2240 | 2289 | | |
2241 | 2290 | | |
2242 | | - | |
2243 | | - | |
2244 | | - | |
2245 | | - | |
2246 | | - | |
2247 | | - | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
2248 | 2297 | | |
2249 | 2298 | | |
2250 | 2299 | | |
| |||
2280 | 2329 | | |
2281 | 2330 | | |
2282 | 2331 | | |
2283 | | - | |
2284 | | - | |
2285 | | - | |
2286 | | - | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
2287 | 2336 | | |
2288 | 2337 | | |
2289 | 2338 | | |
| |||
2320 | 2369 | | |
2321 | 2370 | | |
2322 | 2371 | | |
2323 | | - | |
2324 | | - | |
2325 | | - | |
2326 | | - | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
2327 | 2376 | | |
2328 | 2377 | | |
2329 | 2378 | | |
| |||
2338 | 2387 | | |
2339 | 2388 | | |
2340 | 2389 | | |
2341 | | - | |
2342 | | - | |
2343 | | - | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
2344 | 2393 | | |
2345 | 2394 | | |
2346 | 2395 | | |
| |||
0 commit comments