diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index 8805b35..7af0614 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -10,7 +10,7 @@ {"_type":"issue","id":"omarchy-wled-bgv","title":"Core: send color to WLED via HTTP API","description":"Send RGB color to WLED device using /json/state API endpoint. Accept IP at runtime.","status":"closed","priority":1,"issue_type":"task","assignee":"Eric Dahl","owner":"dahl.eric@gmail.com","created_at":"2026-05-01T03:23:31Z","created_by":"Eric Dahl","updated_at":"2026-05-01T15:38:06Z","started_at":"2026-05-01T03:23:41Z","closed_at":"2026-05-01T03:24:12Z","close_reason":"Closed","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/22","dependencies":[{"issue_id":"omarchy-wled-bgv","depends_on_id":"omarchy-wled-p8g","type":"blocks","created_at":"2026-04-30T23:23:34Z","created_by":"Eric Dahl","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} {"_type":"issue","id":"omarchy-wled-iqx","title":"Core: watch for theme changes and update WLED","description":"Use inotify (watchdog) to detect changes to ~/.config/omarchy/current/theme/colors.toml and push new accent color to WLED automatically.","status":"closed","priority":1,"issue_type":"feature","assignee":"Eric Dahl","owner":"dahl.eric@gmail.com","created_at":"2026-05-01T03:23:30Z","created_by":"Eric Dahl","updated_at":"2026-05-01T15:38:06Z","started_at":"2026-05-01T03:24:13Z","closed_at":"2026-05-01T03:24:17Z","close_reason":"Closed","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/23","dependencies":[{"issue_id":"omarchy-wled-iqx","depends_on_id":"omarchy-wled-bgv","type":"blocks","created_at":"2026-04-30T23:23:35Z","created_by":"Eric Dahl","metadata":"{}"},{"issue_id":"omarchy-wled-iqx","depends_on_id":"omarchy-wled-p8g","type":"blocks","created_at":"2026-04-30T23:23:35Z","created_by":"Eric Dahl","metadata":"{}"}],"dependency_count":2,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"omarchy-wled-p8g","title":"Core: read accent color from Omarchy theme","description":"Parse accent color from ~/.config/omarchy/current/theme/colors.toml and return as RGB tuple. This is the foundation all other features depend on.","status":"closed","priority":1,"issue_type":"task","assignee":"Eric Dahl","owner":"dahl.eric@gmail.com","created_at":"2026-05-01T03:23:30Z","created_by":"Eric Dahl","updated_at":"2026-05-01T15:38:07Z","started_at":"2026-05-01T03:23:40Z","closed_at":"2026-05-01T03:24:12Z","close_reason":"Closed","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/24","dependency_count":0,"dependent_count":2,"comment_count":0} -{"_type":"issue","id":"omarchy-wled-jip","title":"tui: fix misleading RGB variable names in View swatch","description":"In tui.go non-gradient preview branch, the third channel is named `c` but holds blue (B). Rename to `r, g, b` (or `b`) so readers do not confuse with generic color. No behavior change.","status":"closed","priority":2,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:26Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:35:26Z","closed_at":"2026-05-04T02:35:26Z","close_reason":"Merged via PRs #46–#49 (readability pass).","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"omarchy-wled-jip","title":"tui: fix misleading RGB variable names in View swatch","description":"In tui.go non-gradient preview branch, the third channel is named `c` but holds blue (B). Rename to `r, g, b` (or `b`) so readers do not confuse with generic color. No behavior change.","status":"closed","priority":2,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:26Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:45:02Z","closed_at":"2026-05-04T02:35:26Z","close_reason":"Merged via PRs #46–#49 (readability pass).","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/51","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"omarchy-wled-5a1","title":"Revisit: Python TUI vs Go core duplication","description":"ADR-0005 keeps Go as core; Python TUI may duplicate colour logic. Options: document intentional drift boundary or have TUI delegate reads to Go binary.","notes":"Direction (2026-05): long-term plan is to port the TUI to a Go-compatible stack so colour/WLED logic stays in one language; short-term drift vs delegate-to-binary is lower priority until that port is scheduled.","status":"closed","priority":2,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-03T04:01:32Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:24:20Z","closed_at":"2026-05-03T04:37:38Z","close_reason":"Go TUI shipped as omarchy-wled tui; Python deprecation is follow-up (R1 docs, R2 remove)","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/39","labels":["architecture"],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"omarchy-wled-3fq","title":"Deepen: Sentinel/poll fallback adapter","description":"Align with ADR-0003: explicit adapter for poll path + sentinel callable so new ColorSources cannot silently omit poll support.","status":"closed","priority":2,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-03T04:01:31Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:40:48Z","closed_at":"2026-05-04T02:40:48Z","close_reason":"PollFallback + PreparePushColors/DeliverPreparedColors (ADR-0007).","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/40","labels":["architecture"],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"omarchy-wled-u66","title":"Revisit: split main.go into packages","description":"Conflicts CONTEXT.md single-file layout and ADR-0001 spirit for small tools. Proceed only if navigation friction outweighs ADR-0005 simplicity; update CONTEXT + ADR if split happens.","status":"closed","priority":2,"issue_type":"decision","owner":"dahl.eric@gmail.com","created_at":"2026-05-03T04:01:31Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:24:21Z","closed_at":"2026-05-03T05:01:21Z","close_reason":"Go core split into internal/paths, color, config, wallpaper, wled, source, daemon; ADR-0006 + CONTEXT/AGENTS updated. main.go is CLI wiring only.","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/41","labels":["architecture"],"dependency_count":0,"dependent_count":0,"comment_count":0} @@ -32,13 +32,13 @@ {"_type":"issue","id":"omarchy-wled-1777649880013-3-2a984396","title":"refactor: remove shallow read_accent_color / read_foreground_color wrappers","description":"## Problem\n\n`read_accent_color` and `read_foreground_color` (L76–83) are thin wrappers over `_read_color_key`. They're only referenced in tests and imply a stable public API that doesn't exist. Deletion test passes — removing them concentrates no complexity.\n\n## Fix\n\nRemove both functions. Tests should use `ThemeColorSource` or `_read_color_key` directly.","status":"closed","priority":2,"issue_type":"task","created_at":"2026-05-01T15:03:51Z","updated_at":"2026-05-01T15:26:38Z","closed_at":"2026-05-01T15:26:39Z","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/6","source_system":"github:https://github.com/ericdahl-dev/omarchy-wled/issues/6:6","metadata":null,"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"omarchy-wled-1777649879832-2-e2c09327","title":"bug: watch() ignores source.watch_path() — BgColorSource never triggers","description":"## Problem\n\n`watch()` hardcodes `THEME_NAME_FILE.parent` as the watched directory regardless of the active source. `BgColorSource` (and any future source) never fires because the observer watches the wrong directory.\n\n```python\n# L224 — always watches theme dir\nobserver.schedule(Handler(), str(THEME_NAME_FILE.parent), recursive=False)\n# should be:\nobserver.schedule(Handler(), str(source.watch_path().parent), recursive=False)\n```\n\nThe `watch_path()` seam exists on the `ColorSource` protocol precisely for this — it's just unused.\n\n## Fix\n\nReplace the hardcoded path with `source.watch_path().parent`.","status":"closed","priority":2,"issue_type":"bug","assignee":"Copilot","created_at":"2026-05-01T15:03:46Z","updated_at":"2026-05-01T15:20:53Z","closed_at":"2026-05-01T15:20:54Z","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/5","source_system":"github:https://github.com/ericdahl-dev/omarchy-wled/issues/5:5","metadata":null,"labels":["bug"],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"omarchy-wled-1777649879686-1-13dd76b4","title":"AUR release","description":"Can we get AUR releases happening from GitHub via tags? Research how, implement and make a PR","status":"closed","priority":2,"issue_type":"task","assignee":"Copilot","created_at":"2026-05-01T11:32:17Z","updated_at":"2026-05-01T14:22:02Z","closed_at":"2026-05-01T14:22:03Z","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/2","source_system":"github:https://github.com/ericdahl-dev/omarchy-wled/issues/2:2","metadata":null,"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"omarchy-wled-6i0","title":"source: clarify Source interface methods for polling vs fsnotify","description":"Expand package or interface doc comments for Sentinel() (poll fingerprint string) and IsTrigger(path) (whether this path should trigger a color refresh). Optional follow-up: consider renaming to ChangeFingerprint / PathTriggersRefresh if willing to touch the interface.","status":"closed","priority":3,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:29Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:35:27Z","closed_at":"2026-05-04T02:35:27Z","close_reason":"Merged via PRs #46–#49 (readability pass).","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"omarchy-wled-507","title":"tui: document or rename preview debounce fields (previewGen/previewArm)","description":"tuiModel uses previewGen and previewArm for debounced preview scheduling. Add a short comment block above the fields explaining the generation/token pattern, or rename to clearer names (e.g. previewRequestSeq / previewAcceptedSeq).","status":"closed","priority":3,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:28Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:35:26Z","closed_at":"2026-05-04T02:35:26Z","close_reason":"Merged via PRs #46–#49 (readability pass).","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"omarchy-wled-t7t","title":"tui: replace magic index 2 for wallpaper source with named constant","description":"tui.go uses `sourceIx == 2` throughout for wallpaper/Wallpaper avg. Introduce a named constant (e.g. sourceIndexWallpaper) next to sourceMaxIdx/sourceLabels so intent is obvious without counting UI rows.","status":"closed","priority":3,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:28Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:35:26Z","closed_at":"2026-05-04T02:35:26Z","close_reason":"Merged via PRs #46–#49 (readability pass).","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"omarchy-wled-6i0","title":"source: clarify Source interface methods for polling vs fsnotify","description":"Expand package or interface doc comments for Sentinel() (poll fingerprint string) and IsTrigger(path) (whether this path should trigger a color refresh). Optional follow-up: consider renaming to ChangeFingerprint / PathTriggersRefresh if willing to touch the interface.","status":"closed","priority":3,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:29Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:45:11Z","closed_at":"2026-05-04T02:35:27Z","close_reason":"Merged via PRs #46–#49 (readability pass).","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/52","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"omarchy-wled-507","title":"tui: document or rename preview debounce fields (previewGen/previewArm)","description":"tuiModel uses previewGen and previewArm for debounced preview scheduling. Add a short comment block above the fields explaining the generation/token pattern, or rename to clearer names (e.g. previewRequestSeq / previewAcceptedSeq).","status":"closed","priority":3,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:28Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:45:11Z","closed_at":"2026-05-04T02:35:26Z","close_reason":"Merged via PRs #46–#49 (readability pass).","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/53","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"omarchy-wled-t7t","title":"tui: replace magic index 2 for wallpaper source with named constant","description":"tui.go uses `sourceIx == 2` throughout for wallpaper/Wallpaper avg. Introduce a named constant (e.g. sourceIndexWallpaper) next to sourceMaxIdx/sourceLabels so intent is obvious without counting UI rows.","status":"closed","priority":3,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:28Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:45:12Z","closed_at":"2026-05-04T02:35:26Z","close_reason":"Merged via PRs #46–#49 (readability pass).","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/54","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"omarchy-wled-8pr","title":"refactor: extract Handler class from watch() closure for testability","description":"Handler is embedded inside watch() as a closure. Cannot be instantiated in tests. _maybe_push behavior (is_trigger, sleep, push_if_changed) is untested. Extract as top-level class taking source/state/ip/brightness/saturation.","status":"closed","priority":3,"issue_type":"task","assignee":"Eric Dahl","owner":"dahl.eric@gmail.com","created_at":"2026-05-02T20:15:30Z","created_by":"Eric Dahl","updated_at":"2026-05-02T21:25:25Z","started_at":"2026-05-02T20:18:06Z","closed_at":"2026-05-02T20:22:56Z","close_reason":"Closed","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/32","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"omarchy-wled-l8w","title":"refactor: debounce WLED HTTP sends on brightness/saturation keystrokes","description":"Every keystroke in brightness/saturation fields fires a blocking HTTP POST to WLED via _refresh_color_preview. No debounce means typing '128' sends 3 requests. Add ~300ms debounce.","status":"closed","priority":3,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-02T20:15:29Z","created_by":"Eric Dahl","updated_at":"2026-05-02T21:26:24Z","started_at":"2026-05-02T20:18:06Z","closed_at":"2026-05-02T21:26:24Z","close_reason":"Closed","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/33","metadata":null,"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"omarchy-wled-2fk","title":"docs: extend CONTEXT.md with Omarchy paths and WLED/sentinel glossary","description":"Per readability review: add short glossary entries to CONTEXT.md for Omarchy paths (colors.toml, theme.name, background symlink), WLED concepts (seg.i spatial gradient, bri), and watcher vs Sentinel polling so code can stay terse without losing new readers. Only if CONTEXT.md already exists and project wants narrative docs.","status":"closed","priority":4,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:37Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:35:27Z","closed_at":"2026-05-04T02:35:27Z","close_reason":"Merged via PRs #46–#49 (readability pass).","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"omarchy-wled-4np","title":"color: unpack regex submatches in NamedHexFromColorsToml","description":"In internal/color/color.go loop over FindAllStringSubmatch, replace opaque m[1]/m[2] with named locals (e.g. key, hexDigits) for scanability. No logic change.","status":"closed","priority":4,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:32Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:35:28Z","closed_at":"2026-05-04T02:35:28Z","close_reason":"Merged via PRs #46–#49 (readability pass).","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"omarchy-wled-zhj","title":"daemon/wled: internal naming polish for readability","description":"Small renames/comments: daemon PushCurrentColorIfChanged printf vars `a, z` -\u003e strip endpoints (e.g. firstRGB/lastRGB); gradientSent struct -\u003e clearer last-gradient cache name; wled jsonGETURL / seg.i `iArr` add one-line comment that payload follows WLED seg.i (offset + hex per LED). Keep behavior identical.","status":"closed","priority":4,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:31Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:35:28Z","closed_at":"2026-05-04T02:35:28Z","close_reason":"Merged via PRs #46–#49 (readability pass).","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"omarchy-wled-94c","title":"tests: align main_test.go section headers with current API names","description":"main_test.go section comments still reference legacy labels (readColorKey, applySaturation, sendColorToWLED, makeSource). Update headers to match actual symbols (NamedHexFromColorsToml, ScaleSaturation, PostSolidJSON, FromFlag, etc.) for grep/nav consistency.","status":"closed","priority":4,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:30Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:35:28Z","closed_at":"2026-05-04T02:35:28Z","close_reason":"Merged via PRs #46–#49 (readability pass).","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"omarchy-wled-2fk","title":"docs: extend CONTEXT.md with Omarchy paths and WLED/sentinel glossary","description":"Per readability review: add short glossary entries to CONTEXT.md for Omarchy paths (colors.toml, theme.name, background symlink), WLED concepts (seg.i spatial gradient, bri), and watcher vs Sentinel polling so code can stay terse without losing new readers. Only if CONTEXT.md already exists and project wants narrative docs.","status":"closed","priority":4,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:37Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:45:12Z","closed_at":"2026-05-04T02:35:27Z","close_reason":"Merged via PRs #46–#49 (readability pass).","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/55","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"omarchy-wled-4np","title":"color: unpack regex submatches in NamedHexFromColorsToml","description":"In internal/color/color.go loop over FindAllStringSubmatch, replace opaque m[1]/m[2] with named locals (e.g. key, hexDigits) for scanability. No logic change.","status":"closed","priority":4,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:32Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:45:13Z","closed_at":"2026-05-04T02:35:28Z","close_reason":"Merged via PRs #46–#49 (readability pass).","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/56","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"omarchy-wled-zhj","title":"daemon/wled: internal naming polish for readability","description":"Small renames/comments: daemon PushCurrentColorIfChanged printf vars `a, z` -\u003e strip endpoints (e.g. firstRGB/lastRGB); gradientSent struct -\u003e clearer last-gradient cache name; wled jsonGETURL / seg.i `iArr` add one-line comment that payload follows WLED seg.i (offset + hex per LED). Keep behavior identical.","status":"open","priority":4,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:31Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:45:18Z","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/57","metadata":null,"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"omarchy-wled-94c","title":"tests: align main_test.go section headers with current API names","description":"main_test.go section comments still reference legacy labels (readColorKey, applySaturation, sendColorToWLED, makeSource). Update headers to match actual symbols (NamedHexFromColorsToml, ScaleSaturation, PostSolidJSON, FromFlag, etc.) for grep/nav consistency.","status":"closed","priority":4,"issue_type":"task","owner":"dahl.eric@gmail.com","created_at":"2026-05-04T02:28:30Z","created_by":"Eric Dahl","updated_at":"2026-05-04T02:45:14Z","closed_at":"2026-05-04T02:35:28Z","close_reason":"Merged via PRs #46–#49 (readability pass).","external_ref":"https://github.com/ericdahl-dev/omarchy-wled/issues/58","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"memory","key":"always-write-code-that-is-self-documenting-a","value":"always write code that is self documenting. a human should be able to understand the code by reading it."} diff --git a/main.go b/main.go index 9250569..be6c859 100644 --- a/main.go +++ b/main.go @@ -65,6 +65,7 @@ func parseArgs(args []string, cfg map[string]string, output io.Writer) (*cliOpts opts := &cliOpts{} fs.BoolVar(&opts.showVersion, "v", false, "Print version and exit") + fs.BoolVar(&opts.showVersion, "V", false, "Print version and exit") fs.BoolVar(&opts.showVersion, "version", false, "Print version and exit") sourceName := fs.String("source", defaultSource, @@ -111,6 +112,16 @@ func validateCli(opts *cliOpts) error { return nil } +func argsRequestVersion(args []string) bool { + for _, a := range args { + switch a { + case "-v", "-V", "-version", "--version": + return true + } + } + return false +} + func main() { paths.Init() @@ -122,6 +133,11 @@ func main() { return } + if argsRequestVersion(os.Args[1:]) { + fmt.Println(version) + os.Exit(0) + } + cfg := config.LoadFlatFile(paths.ConfigPath) opts, err := parseArgs(os.Args[1:], cfg, os.Stderr) if err != nil { diff --git a/main_test.go b/main_test.go index 7065530..eae2318 100644 --- a/main_test.go +++ b/main_test.go @@ -612,6 +612,18 @@ func TestBgSourceIsTriggerOnBackgroundLink(t *testing.T) { // parseArgs / version // --------------------------------------------------------------------------- +func TestArgsRequestVersion(t *testing.T) { + if !argsRequestVersion([]string{"-v"}) || !argsRequestVersion([]string{"-V"}) { + t.Fatal("expected -v and -V") + } + if !argsRequestVersion([]string{"-source", "accent", "--version"}) { + t.Fatal("expected --version anywhere in argv") + } + if argsRequestVersion([]string{"-source", "accent"}) { + t.Fatal("unexpected") + } +} + func TestParseArgsVersionShortFlag(t *testing.T) { opts, err := parseArgs([]string{"-v"}, map[string]string{}, io.Discard) if err != nil { @@ -635,6 +647,16 @@ func TestParseArgsVersionLongFlag(t *testing.T) { } } +func TestParseArgsVersionDashUpperV(t *testing.T) { + opts, err := parseArgs([]string{"-V"}, map[string]string{}, io.Discard) + if err != nil { + t.Fatal(err) + } + if !opts.showVersion { + t.Fatal("showVersion: want true for -V") + } +} + func TestParseArgsUnknownFlag(t *testing.T) { _, err := parseArgs([]string{"-notreal"}, map[string]string{}, io.Discard) if err == nil {