Commit dd23d1750e

dd23d1750ebb9381fd5d647b8667f6c532bdc026

parent: 4b7a42dfb4

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-24 04:33 UTC

control: gofmt the generated summaries; drop unused helpers

Ref #254

Layout: unified · split

cmd/gitbay/summaries_gen.go +231 −231
@@ -3,236 +3,236 @@
3package main 3package main
4 4
5var summaries = map[string]string{ 5var summaries = map[string]string{
6 "account export": "write your account bundle (profile, repos, issues, MRs) as JSON", 6 "account export": "write your account bundle (profile, repos, issues, MRs) as JSON",
7 "account import-bundle": "replay an account bundle (see gitbay migrate)", 7 "account import-bundle": "replay an account bundle (see gitbay migrate)",
8 "admin email verify": "mark an address verified by admin assertion", 8 "admin email verify": "mark an address verified by admin assertion",
9 "admin invite": "issue a registration invite and mail its code", 9 "admin invite": "issue a registration invite and mail its code",
10 "admin mr prune": "drop merged or closed MRs' head refs and the objects only they kept, e.g. after a history rewrite (instance admins; audited)", 10 "admin mr prune": "drop merged or closed MRs' head refs and the objects only they kept, e.g. after a history rewrite (instance admins; audited)",
11 "admin repo archive": "archive any repository (instance admins; audited)", 11 "admin repo archive": "archive any repository (instance admins; audited)",
12 "admin repo delete": "delete any repository (instance admins; audited)", 12 "admin repo delete": "delete any repository (instance admins; audited)",
13 "admin repo list": "list every repository with size and last push (instance admins)", 13 "admin repo list": "list every repository with size and last push (instance admins)",
14 "admin repo unarchive": "unarchive any repository (instance admins; audited)", 14 "admin repo unarchive": "unarchive any repository (instance admins; audited)",
15 "admin repo visibility": "set any repository's visibility (instance admins; audited)", 15 "admin repo visibility": "set any repository's visibility (instance admins; audited)",
16 "admin runners forget": "alias of admin runners remove", 16 "admin runners forget": "alias of admin runners remove",
17 "admin runners remove": "drop a key's runner heartbeat row, e.g. one that polled once by mistake (instance admins)", 17 "admin runners remove": "drop a key's runner heartbeat row, e.g. one that polled once by mistake (instance admins)",
18 "admin runners": "the build queue and runner accounts: last poll, scope, the build each holds (instance admins)", 18 "admin runners": "the build queue and runner accounts: last poll, scope, the build each holds (instance admins)",
19 "admin stats": "instance statistics: counts and per-repository disk usage", 19 "admin stats": "instance statistics: counts and per-repository disk usage",
20 "admin user create": "create an account, optionally with a key and a verified address (instance admins)", 20 "admin user create": "create an account, optionally with a key and a verified address (instance admins)",
21 "admin user delete": "delete an account that anchors nothing (keys, emails and sessions go with it)", 21 "admin user delete": "delete an account that anchors nothing (keys, emails and sessions go with it)",
22 "admin user demote": "remove instance admin from an account (never the last one)", 22 "admin user demote": "remove instance admin from an account (never the last one)",
23 "admin user disable": "suspend an account: SSH, web sessions and API tokens refused until re-enabled", 23 "admin user disable": "suspend an account: SSH, web sessions and API tokens refused until re-enabled",
24 "admin user enable": "restore a suspended account", 24 "admin user enable": "restore a suspended account",
25 "admin user limits": "show or set an account's repository and storage caps (instance admins)", 25 "admin user limits": "show or set an account's repository and storage caps (instance admins)",
26 "admin user list": "list accounts (instance admins)", 26 "admin user list": "list accounts (instance admins)",
27 "admin user promote": "make an account an instance admin", 27 "admin user promote": "make an account an instance admin",
28 "admin user show": "show an account: keys, emails, orgs, tokens, sessions (instance admins)", 28 "admin user show": "show an account: keys, emails, orgs, tokens, sessions (instance admins)",
29 "audit": "instance audit log (admins)", 29 "audit": "instance audit log (admins)",
30 "build cancel": "withdraw a queued build before a runner claims it", 30 "build cancel": "withdraw a queued build before a runner claims it",
31 "build jobs": "list the jobs a trigger can name", 31 "build jobs": "list the jobs a trigger can name",
32 "build list": "list recent builds", 32 "build list": "list recent builds",
33 "build log": "print a build's log, or follow it until the build ends", 33 "build log": "print a build's log, or follow it until the build ends",
34 "build show": "show one build", 34 "build show": "show one build",
35 "build trigger": "queue a job now (scheduled or not)", 35 "build trigger": "queue a job now (scheduled or not)",
36 "dashboard": "one read for the account dashboard: review queue, assigned and open work, pins, activity, builds", 36 "dashboard": "one read for the account dashboard: review queue, assigned and open work, pins, activity, builds",
37 "email add": "add an address and mail a verification code", 37 "email add": "add an address and mail a verification code",
38 "email list": "list the addresses on your account", 38 "email list": "list the addresses on your account",
39 "email primary": "make a verified address the primary", 39 "email primary": "make a verified address the primary",
40 "email remove": "remove an address; not the primary, nor the last verified one", 40 "email remove": "remove an address; not the primary, nor the last verified one",
41 "email verify": "confirm a verification code", 41 "email verify": "confirm a verification code",
42 "explore": "list public repositories", 42 "explore": "list public repositories",
43 "feed": "activity on repositories you can reach", 43 "feed": "activity on repositories you can reach",
44 "help": "list available commands", 44 "help": "list available commands",
45 "issue assign": "assignees", 45 "issue assign": "assignees",
46 "issue close": "close an issue", 46 "issue close": "close an issue",
47 "issue comment": "comment", 47 "issue comment": "comment",
48 "issue create": "open an issue", 48 "issue create": "open an issue",
49 "issue edit": "edit title or body", 49 "issue edit": "edit title or body",
50 "issue label": "labels", 50 "issue label": "labels",
51 "issue list": "list issues", 51 "issue list": "list issues",
52 "issue milestone": "set or clear an issue's milestone", 52 "issue milestone": "set or clear an issue's milestone",
53 "issue reopen": "reopen an issue", 53 "issue reopen": "reopen an issue",
54 "issue show": "show an issue with comments", 54 "issue show": "show an issue with comments",
55 "issue templates": "list issue templates (.gitbay/issue-template*.md)", 55 "issue templates": "list issue templates (.gitbay/issue-template*.md)",
56 "keys add": "register an SSH public key (authorized_keys format)", 56 "keys add": "register an SSH public key (authorized_keys format)",
57 "keys label": "name a key; an empty label clears it", 57 "keys label": "name a key; an empty label clears it",
58 "keys list": "list registered SSH keys", 58 "keys list": "list registered SSH keys",
59 "keys remove": "remove an SSH key by fingerprint", 59 "keys remove": "remove an SSH key by fingerprint",
60 "label list": "list a repository's labels with colour and use", 60 "label list": "list a repository's labels with colour and use",
61 "label remove": "remove a label from the repository and from every issue and merge request", 61 "label remove": "remove a label from the repository and from every issue and merge request",
62 "label set": "create a label or set its colour", 62 "label set": "create a label or set its colour",
63 "milestone close": "close a milestone", 63 "milestone close": "close a milestone",
64 "milestone create": "create a milestone", 64 "milestone create": "create a milestone",
65 "milestone list": "list milestones with progress", 65 "milestone list": "list milestones with progress",
66 "milestone reopen": "reopen a milestone", 66 "milestone reopen": "reopen a milestone",
67 "mr close": "close without merging", 67 "mr close": "close without merging",
68 "mr comment": "comment", 68 "mr comment": "comment",
69 "mr create": "open a merge request", 69 "mr create": "open a merge request",
70 "mr diff": "show the diff", 70 "mr diff": "show the diff",
71 "mr diff-comment": "comment on a diff line", 71 "mr diff-comment": "comment on a diff line",
72 "mr draft": "mark a merge request as work in progress", 72 "mr draft": "mark a merge request as work in progress",
73 "mr edit": "edit title or body", 73 "mr edit": "edit title or body",
74 "mr label": "labels", 74 "mr label": "labels",
75 "mr list": "list merge requests", 75 "mr list": "list merge requests",
76 "mr merge": "merge", 76 "mr merge": "merge",
77 "mr milestone": "set or clear an MR's milestone", 77 "mr milestone": "set or clear an MR's milestone",
78 "mr range-diff": "what changed between two revisions of a merge request", 78 "mr range-diff": "what changed between two revisions of a merge request",
79 "mr ready": "take the draft mark off, so it can merge", 79 "mr ready": "take the draft mark off, so it can merge",
80 "mr resolve": "resolve a review thread", 80 "mr resolve": "resolve a review thread",
81 "mr retarget": "retarget onto another branch", 81 "mr retarget": "retarget onto another branch",
82 "mr review request": "ask specific people for a review", 82 "mr review request": "ask specific people for a review",
83 "mr review": "review", 83 "mr review": "review",
84 "mr revisions": "the heads a merge request has had", 84 "mr revisions": "the heads a merge request has had",
85 "mr show": "show a merge request", 85 "mr show": "show a merge request",
86 "mr threads": "review threads on an MR", 86 "mr threads": "review threads on an MR",
87 "mr unresolve": "reopen a review thread", 87 "mr unresolve": "reopen a review thread",
88 "notifications device add": "register an Apple device for push, token on stdin", 88 "notifications device add": "register an Apple device for push, token on stdin",
89 "notifications device list": "your registered devices", 89 "notifications device list": "your registered devices",
90 "notifications device remove": "deregister a device", 90 "notifications device remove": "deregister a device",
91 "notifications list": "your notification inbox, newest first", 91 "notifications list": "your notification inbox, newest first",
92 "notifications read": "mark notifications read", 92 "notifications read": "mark notifications read",
93 "notifications settings mail": "activity by mail as well as the inbox (login links are unaffected)", 93 "notifications settings mail": "activity by mail as well as the inbox (login links are unaffected)",
94 "notifications settings push": "activity on your registered devices as well as the inbox", 94 "notifications settings push": "activity on your registered devices as well as the inbox",
95 "notifications settings show": "your notification preferences", 95 "notifications settings show": "your notification preferences",
96 "notifications settings watch": "every issue and merge request on repositories you can write to", 96 "notifications settings watch": "every issue and merge request on repositories you can write to",
97 "org create": "create an organization (you become its first admin)", 97 "org create": "create an organization (you become its first admin)",
98 "org delete": "delete an empty organization", 98 "org delete": "delete an empty organization",
99 "org label list": "list an org's labels with use across the repositories you can read", 99 "org label list": "list an org's labels with use across the repositories you can read",
100 "org label remove": "remove an org label from the org and from every issue under it", 100 "org label remove": "remove an org label from the org and from every issue under it",
101 "org label set": "create an org label every org repository sees, or set its colour; folds in same-named repo labels", 101 "org label set": "create an org label every org repository sees, or set its colour; folds in same-named repo labels",
102 "org list": "list organizations you belong to", 102 "org list": "list organizations you belong to",
103 "org members add": "add or update a member", 103 "org members add": "add or update a member",
104 "org members list": "list members", 104 "org members list": "list members",
105 "org members remove": "remove a member", 105 "org members remove": "remove a member",
106 "org milestone close": "close an org milestone", 106 "org milestone close": "close an org milestone",
107 "org milestone create": "create an org milestone spanning every org repository; folds in same-titled repo milestones", 107 "org milestone create": "create an org milestone spanning every org repository; folds in same-titled repo milestones",
108 "org milestone list": "list an org's milestones with progress across the repositories you can read", 108 "org milestone list": "list an org's milestones with progress across the repositories you can read",
109 "org milestone reopen": "reopen an org milestone", 109 "org milestone reopen": "reopen an org milestone",
110 "org profile": "show or set an org's profile", 110 "org profile": "show or set an org's profile",
111 "org rename": "rename an organization", 111 "org rename": "rename an organization",
112 "org settings members-role": "role plain membership implies on every org repo", 112 "org settings members-role": "role plain membership implies on every org repo",
113 "org show": "show an organization and its members", 113 "org show": "show an organization and its members",
114 "org team add": "add org members to a team", 114 "org team add": "add org members to a team",
115 "org team create": "create a team", 115 "org team create": "create a team",
116 "org team delete": "delete a team (its grants with it)", 116 "org team delete": "delete a team (its grants with it)",
117 "org team grant": "grant a team a role on an org repo", 117 "org team grant": "grant a team a role on an org repo",
118 "org team list": "list an org's teams", 118 "org team list": "list an org's teams",
119 "org team remove": "remove members from a team", 119 "org team remove": "remove members from a team",
120 "org team revoke": "revoke a team's grant", 120 "org team revoke": "revoke a team's grant",
121 "org team show": "show a team's members and grants", 121 "org team show": "show a team's members and grants",
122 "pgp add": "register an OpenPGP public key (armored)", 122 "pgp add": "register an OpenPGP public key (armored)",
123 "pgp list": "list registered OpenPGP keys", 123 "pgp list": "list registered OpenPGP keys",
124 "pgp remove": "remove an OpenPGP key by fingerprint", 124 "pgp remove": "remove an OpenPGP key by fingerprint",
125 "profile set": "set your profile", 125 "profile set": "set your profile",
126 "profile show": "show a user's or org's profile", 126 "profile show": "show a user's or org's profile",
127 "register": "create an account (only meaningful for unregistered keys)", 127 "register": "create an account (only meaningful for unregistered keys)",
128 "release asset add": "upload an asset from stdin", 128 "release asset add": "upload an asset from stdin",
129 "release asset get": "write an asset to stdout", 129 "release asset get": "write an asset to stdout",
130 "release asset remove": "remove an asset", 130 "release asset remove": "remove an asset",
131 "release create": "create a release on a tag", 131 "release create": "create a release on a tag",
132 "release delete": "delete a release and its assets", 132 "release delete": "delete a release and its assets",
133 "release edit": "update a release's title and notes", 133 "release edit": "update a release's title and notes",
134 "release list": "list releases", 134 "release list": "list releases",
135 "release show": "show a release with assets", 135 "release show": "show a release with assets",
136 "repo access grant": "grant access", 136 "repo access grant": "grant access",
137 "repo access list": "list who can reach the repository, with the role and where it comes from", 137 "repo access list": "list who can reach the repository, with the role and where it comes from",
138 "repo access revoke": "revoke access", 138 "repo access revoke": "revoke access",
139 "repo archive": "archive a repository (read-only: pushes and issue/MR writes refused)", 139 "repo archive": "archive a repository (read-only: pushes and issue/MR writes refused)",
140 "repo blame": "attribute lines to commits", 140 "repo blame": "attribute lines to commits",
141 "repo bookmark": "bookmark a repository to come back to", 141 "repo bookmark": "bookmark a repository to come back to",
142 "repo bookmarks": "list the repositories you have bookmarked", 142 "repo bookmarks": "list the repositories you have bookmarked",
143 "repo cat": "read a file", 143 "repo cat": "read a file",
144 "repo commit": "show one commit with its patch", 144 "repo commit": "show one commit with its patch",
145 "repo commit-file": "write a file and commit it", 145 "repo commit-file": "write a file and commit it",
146 "repo create": "create a repository", 146 "repo create": "create a repository",
147 "repo delete": "delete a repository", 147 "repo delete": "delete a repository",
148 "repo deploy-key add": "bind a read-only (or --rw) key to one repository", 148 "repo deploy-key add": "bind a read-only (or --rw) key to one repository",
149 "repo deploy-key list": "list deploy keys", 149 "repo deploy-key list": "list deploy keys",
150 "repo deploy-key remove": "remove a deploy key", 150 "repo deploy-key remove": "remove a deploy key",
151 "repo deps disable": "stop checking dependencies", 151 "repo deps disable": "stop checking dependencies",
152 "repo deps enable": "check dependencies for updates", 152 "repo deps enable": "check dependencies for updates",
153 "repo deps status": "show dependency check state", 153 "repo deps status": "show dependency check state",
154 "repo diff": "the patch between two refs, from their merge base", 154 "repo diff": "the patch between two refs, from their merge base",
155 "repo domain add": "claim a custom pages domain (verify with a DNS TXT record)", 155 "repo domain add": "claim a custom pages domain (verify with a DNS TXT record)",
156 "repo domain list": "list custom pages domains", 156 "repo domain list": "list custom pages domains",
157 "repo domain remove": "remove a custom pages domain", 157 "repo domain remove": "remove a custom pages domain",
158 "repo domain verify": "check the DNS challenge and activate a claim", 158 "repo domain verify": "check the DNS challenge and activate a claim",
159 "repo download": "write a tar.gz of a ref to stdout", 159 "repo download": "write a tar.gz of a ref to stdout",
160 "repo fork": "fork a repository under your account", 160 "repo fork": "fork a repository under your account",
161 "repo grep": "search file contents", 161 "repo grep": "search file contents",
162 "repo import": "server-side mirror of a foreign repository", 162 "repo import": "server-side mirror of a foreign repository",
163 "repo import-issues": "import issue and PR history from GitHub or Forgejo", 163 "repo import-issues": "import issue and PR history from GitHub or Forgejo",
164 "repo list": "list repositories you own or can access", 164 "repo list": "list repositories you own or can access",
165 "repo log": "commit log with signature states", 165 "repo log": "commit log with signature states",
166 "repo mirror add": "mirror to or from a remote", 166 "repo mirror add": "mirror to or from a remote",
167 "repo mirror list": "list mirrors with sync status", 167 "repo mirror list": "list mirrors with sync status",
168 "repo mirror remove": "remove a mirror", 168 "repo mirror remove": "remove a mirror",
169 "repo mirror sync": "schedule an immediate sync", 169 "repo mirror sync": "schedule an immediate sync",
170 "repo mute": "mute a repository, including work you are part of", 170 "repo mute": "mute a repository, including work you are part of",
171 "repo pin": "pin a repository to your dashboard", 171 "repo pin": "pin a repository to your dashboard",
172 "repo refs": "list branches and tags", 172 "repo refs": "list branches and tags",
173 "repo rename": "rename a repository", 173 "repo rename": "rename a repository",
174 "repo runner add": "attach a runner's public key to a repository", 174 "repo runner add": "attach a runner's public key to a repository",
175 "repo runner list": "list the runners attached to a repository", 175 "repo runner list": "list the runners attached to a repository",
176 "repo runner remove": "detach a runner from a repository", 176 "repo runner remove": "detach a runner from a repository",
177 "repo search": "find repositories by name, description, or topic", 177 "repo search": "find repositories by name, description, or topic",
178 "repo secret list": "list build secret names", 178 "repo secret list": "list build secret names",
179 "repo secret remove": "remove a build secret", 179 "repo secret remove": "remove a build secret",
180 "repo secret set": "set a build secret", 180 "repo secret set": "set a build secret",
181 "repo settings default-branch": "set the default branch", 181 "repo settings default-branch": "set the default branch",
182 "repo settings description": "set the repository description", 182 "repo settings description": "set the repository description",
183 "repo settings git-daemon": "expose over git://", 183 "repo settings git-daemon": "expose over git://",
184 "repo settings protect": "protect a branch", 184 "repo settings protect": "protect a branch",
185 "repo settings protect-tag": "protect tags matching a glob (created once, never moved or deleted)", 185 "repo settings protect-tag": "protect tags matching a glob (created once, never moved or deleted)",
186 "repo settings require-approvals": "require N fresh approvals to merge", 186 "repo settings require-approvals": "require N fresh approvals to merge",
187 "repo settings require-checks": "gate merges on green statuses", 187 "repo settings require-checks": "gate merges on green statuses",
188 "repo settings require-codeowners": "require an owner's approval for every file CODEOWNERS covers", 188 "repo settings require-codeowners": "require an owner's approval for every file CODEOWNERS covers",
189 "repo settings require-mr": "protected branches take changes through merge requests only", 189 "repo settings require-mr": "protected branches take changes through merge requests only",
190 "repo settings require-resolved": "require all review threads resolved to merge", 190 "repo settings require-resolved": "require all review threads resolved to merge",
191 "repo settings require-signed": "require verified commit signatures", 191 "repo settings require-signed": "require verified commit signatures",
192 "repo settings show": "show settings", 192 "repo settings show": "show settings",
193 "repo settings unprotect": "unprotect a branch", 193 "repo settings unprotect": "unprotect a branch",
194 "repo settings unprotect-tag": "drop a protected-tag glob", 194 "repo settings unprotect-tag": "drop a protected-tag glob",
195 "repo settings visibility": "set repository visibility", 195 "repo settings visibility": "set repository visibility",
196 "repo settings website": "set the repository website", 196 "repo settings website": "set the repository website",
197 "repo show": "show repository details", 197 "repo show": "show repository details",
198 "repo topics add": "add topics", 198 "repo topics add": "add topics",
199 "repo topics remove": "remove topics", 199 "repo topics remove": "remove topics",
200 "repo topics": "list topics", 200 "repo topics": "list topics",
201 "repo transfer": "move a repository to another owner", 201 "repo transfer": "move a repository to another owner",
202 "repo tree": "list a directory", 202 "repo tree": "list a directory",
203 "repo unarchive": "unarchive a repository", 203 "repo unarchive": "unarchive a repository",
204 "repo unbookmark": "remove a bookmark", 204 "repo unbookmark": "remove a bookmark",
205 "repo unpin": "unpin a repository", 205 "repo unpin": "unpin a repository",
206 "repo unwatch": "back to the default: only work you are part of", 206 "repo unwatch": "back to the default: only work you are part of",
207 "repo watch": "hear about all activity on a repository", 207 "repo watch": "hear about all activity on a repository",
208 "runner done": "finish a build", 208 "runner done": "finish a build",
209 "runner log": "append a build's log from stdin", 209 "runner log": "append a build's log from stdin",
210 "runner next": "claim the oldest pending build this key may run (runner protocol)", 210 "runner next": "claim the oldest pending build this key may run (runner protocol)",
211 "search": "find repositories, issues and merge requests across the instance", 211 "search": "find repositories, issues and merge requests across the instance",
212 "snippet create": "create a snippet from one file on stdin", 212 "snippet create": "create a snippet from one file on stdin",
213 "snippet delete": "delete a snippet and its files", 213 "snippet delete": "delete a snippet and its files",
214 "snippet edit": "change a snippet's description or visibility", 214 "snippet edit": "change a snippet's description or visibility",
215 "snippet file get": "write a snippet file to stdout", 215 "snippet file get": "write a snippet file to stdout",
216 "snippet file remove": "remove a file from a snippet", 216 "snippet file remove": "remove a file from a snippet",
217 "snippet file set": "add a file to a snippet, or replace one, from stdin", 217 "snippet file set": "add a file to a snippet, or replace one, from stdin",
218 "snippet list": "list your snippets, or an owner's public ones", 218 "snippet list": "list your snippets, or an owner's public ones",
219 "snippet show": "show a snippet's metadata and files", 219 "snippet show": "show a snippet's metadata and files",
220 "status list": "statuses on a commit", 220 "status list": "statuses on a commit",
221 "status set": "report a commit status (CI)", 221 "status set": "report a commit status (CI)",
222 "token create": "mint an API token (shown once)", 222 "token create": "mint an API token (shown once)",
223 "token list": "list API tokens", 223 "token list": "list API tokens",
224 "token revoke": "revoke an API token by name", 224 "token revoke": "revoke an API token by name",
225 "web login": "mint a one-time browser login URL", 225 "web login": "mint a one-time browser login URL",
226 "web sessions list": "list your browser sessions", 226 "web sessions list": "list your browser sessions",
227 "web sessions revoke": "end a browser session, or all of them", 227 "web sessions revoke": "end a browser session, or all of them",
228 "web theme set": "follow the browser's scheme, or force light or dark", 228 "web theme set": "follow the browser's scheme, or force light or dark",
229 "web theme show": "the colour scheme the web UI uses for you", 229 "web theme show": "the colour scheme the web UI uses for you",
230 "webhook add": "add a webhook", 230 "webhook add": "add a webhook",
231 "webhook deliveries": "recent deliveries", 231 "webhook deliveries": "recent deliveries",
232 "webhook list": "list webhooks", 232 "webhook list": "list webhooks",
233 "webhook redeliver": "queue a delivery again", 233 "webhook redeliver": "queue a delivery again",
234 "webhook remove": "remove a webhook", 234 "webhook remove": "remove a webhook",
235 "whoami": "show the authenticated account", 235 "whoami": "show the authenticated account",
236 "wiki list": "list a repository's wiki pages", 236 "wiki list": "list a repository's wiki pages",
237 "wiki show": "print a wiki page", 237 "wiki show": "print a wiki page",
238} 238}
cmd/gitbay/summaries_test.go +7 −2
@@ -3,6 +3,7 @@ package main
3import ( 3import (
4 "flag" 4 "flag"
5 "fmt" 5 "fmt"
6 "go/format"
6 "os" 7 "os"
7 "slices" 8 "slices"
8 "strings" 9 "strings"
@@ -25,11 +26,15 @@ func TestSummariesAreCurrent(t *testing.T) {
25 slices.Sort(lines) 26 slices.Sort(lines)
26 b.WriteString(strings.Join(lines, "")) 27 b.WriteString(strings.Join(lines, ""))
27 b.WriteString("}\n") 28 b.WriteString("}\n")
29 want, err := format.Source([]byte(b.String()))
30 if err != nil {
31 t.Fatal(err)
32 }
28 if *updateSummaries { 33 if *updateSummaries {
29 os.WriteFile("summaries_gen.go", []byte(b.String()), 0o644) 34 os.WriteFile("summaries_gen.go", want, 0o644)
30 } 35 }
31 got, _ := os.ReadFile("summaries_gen.go") 36 got, _ := os.ReadFile("summaries_gen.go")
32 if string(got) != b.String() { 37 if string(got) != string(want) {
33 t.Fatal("summaries_gen.go is stale: go test ./cmd/gitbay -run TestSummariesAreCurrent -update") 38 t.Fatal("summaries_gen.go is stale: go test ./cmd/gitbay -run TestSummariesAreCurrent -update")
34 } 39 }
35} 40}
e2e/readonly_test.go +3 −1
@@ -232,8 +232,10 @@ func TestReadOnlyCommandsWriteNothing(t *testing.T) {
232 } 232 }
233} 233}
234 234
235var sgrRe = regexp.MustCompile("\x1b\\[[0-9;]*m")
236
235func stripSGRe2e(s string) string { 237func stripSGRe2e(s string) string {
236 return regexp.MustCompile("\x1b\\[[0-9;]*m").ReplaceAllString(s, "") 238 return sgrRe.ReplaceAllString(s, "")
237} 239}
238 240
239func displayCells(s string) int { 241func displayCells(s string) int {
internal/control/help.go +2 −1
@@ -112,7 +112,8 @@ func runHelp(c *Ctx, args []string) int {
112} 112}
113 113
114// program is how help spells the command it documents: the CLI at a 114// program is how help spells the command it documents: the CLI at a
115// terminal (only the CLI sends GITBAY_TERM), ssh otherwise. 115// terminal (only the CLI or a caller passing --term sets one), ssh
116// otherwise.
116func (c *Ctx) program() string { 117func (c *Ctx) program() string {
117 if c.Term.Cols > 0 { 118 if c.Term.Cols > 0 {
118 return "gitbay" 119 return "gitbay"
internal/control/term.go +6 −7
@@ -37,13 +37,12 @@ func ParseTerm(v string) Term {
37} 37}
38 38
39const ( 39const (
40 sgrReset = "\x1b[0m" 40 sgrReset = "\x1b[0m"
41 sgrBold = "\x1b[1m" 41 sgrBold = "\x1b[1m"
42 sgrDim = "\x1b[2m" 42 sgrDim = "\x1b[2m"
43 sgrUnderline = "\x1b[4m" 43 sgrRed = "\x1b[31m"
44 sgrRed = "\x1b[31m" 44 sgrGreen = "\x1b[32m"
45 sgrGreen = "\x1b[32m" 45 sgrMagenta = "\x1b[35m"
46 sgrMagenta = "\x1b[35m"
47) 46)
48 47
49// termSafe replaces the bytes a terminal would act on — ESC, the C0 48// termSafe replaces the bytes a terminal would act on — ESC, the C0
internal/control/term_test.go +6 −6
@@ -26,12 +26,12 @@ func TestParseTerm(t *testing.T) {
26 26
27func TestCells(t *testing.T) { 27func TestCells(t *testing.T) {
28 cases := map[string]int{ 28 cases := map[string]int{
29 "abc": 3, 29 "abc": 3,
30 "日本": 4, 30 "日本": 4,
31 "é": 1, 31 "é": 1,
32 "é": 1, 32 "é": 1,
33 "\x1b[32mopen\x1b[0m": 4, 33 "\x1b[32mopen\x1b[0m": 4,
34 "": 0, 34 "": 0,
35 } 35 }
36 for in, want := range cases { 36 for in, want := range cases {
37 if got := cells(in); got != want { 37 if got := cells(in); got != want {