261101.4 · 5735ff673a95384397d923bbcec92a411a6328d1
main.go splits by purpose
main.go held argument parsing, endpoint and token resolution and opening a browser, beside the program's start. They move to args.go, endpoint.go and browser.go, and main_test.go's tests go with the code they cover. main.go keeps main, the reporter, detaching and error codes.
Declarations moved unchanged, as a sorted comparison of every line outside the import blocks confirms. git blame -C -C traces them.
reading declarations
Changes to browser_test.go. All files
@@ -0,0 +1,23 @@+package main++import (+ "slices"+ "testing"+)++func TestOpenArgs(t *testing.T) {+ const lo, lan = "http://127.31.1.1/x/", "http://192.168.1.5/x/"+ for _, c := range []struct {+ url, open string+ want []string+ }{+ {lo, "", []string{"xdg-open", lo}},+ {lo, "brave-browser --app=%s", []string{"brave-browser", "--app=" + lo}},+ {lo, "firefox", []string{"firefox", lo}},+ {lan, "brave-browser --app=%s", []string{"xdg-open", lan}},+ } {+ if got := openArgs(c.url, c.open); !slices.Equal(got, c.want) {+ t.Errorf("openArgs(%q, %q) = %q, want %q", c.url, c.open, got, c.want)+ }+ }+}