Skip to content

Commit ae42a13

Browse files
committed
fixup! Update golden files
1 parent 77db66d commit ae42a13

5 files changed

+16
-11
lines changed

cli/testdata/coder_--help.golden

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ Auth Flags:
5151
--token string Specify an authentication token. For security reasons setting
5252
CODER_SESSION_TOKEN is preferred.
5353
Consumes $CODER_SESSION_TOKEN
54-
5554
Other Flags:
5655
--global-config coder Path to the global coder config directory.
5756
Consumes $CODER_CONFIG_DIR (default "~/.config/coderv2")

cli/testdata/coder_agent_--help.golden

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ Usage:
44
Auth Flags:
55
--auth string Specify the authentication type to use for the agent.
66
Consumes $CODER_AGENT_AUTH (default "token")
7-
87
Operability Flags:
98
--log-dir string Specify the location for the agent log files.
109
Consumes $CODER_AGENT_LOG_DIR (default "/tmp")
1110
--pprof-address string The address to serve pprof.
1211
Consumes $CODER_AGENT_PPROF_ADDRESS (default "127.0.0.1:6060")
13-
1412
Other Flags:
1513
-h, --help help for agent
1614
--no-reap Do not start a process reaper.

cli/testdata/coder_scaletest_create-workspaces_--help.golden

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Operability Flags:
2424
server is configured with the exact same tracing
2525
configuration as the client.
2626
Consumes $CODER_LOADTEST_TRACE_PROPAGATE
27-
2827
Other Flags:
2928
--cleanup-concurrency int Number of concurrent cleanup jobs to run. 0 means
3029
unlimited.

cli/testdata/coder_server_--help.golden

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ Networking Flags:
146146
use for workspace applications in
147147
the form "*.example.com".
148148
Consumes $CODER_WILDCARD_ACCESS_URL
149-
150149
Auth Flags:
151150
--disable-password-auth coder server create-admin Disable password authentication.
152151
This is recommended for security
@@ -245,7 +244,6 @@ Auth Flags:
245244
--disable-session-expiry-refresh.
246245
Consumes $CODER_MAX_SESSION_EXPIRY
247246
(default 24h0m0s)
248-
249247
Operability Flags:
250248
--log-human string Output human-readable logs to a
251249
given file.
@@ -289,7 +287,6 @@ Operability Flags:
289287
flag was supplied, debug-level logs
290288
will be included.
291289
Consumes $CODER_TRACE_CAPTURE_LOGS
292-
293290
Provisioning Flags:
294291
--provisioner-daemon-poll-interval duration Time to wait before polling for a
295292
new job.
@@ -309,7 +306,6 @@ Provisioning Flags:
309306
tasks that are stuck.
310307
Consumes
311308
$CODER_PROVISIONER_FORCE_CANCEL_INTERVAL (default 10m0s)
312-
313309
Other Flags:
314310
--cache-dir string The directory to cache temporary
315311
files. If unspecified and

cli/usage.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,23 @@ func categorizeFlags(usageOutput string) string {
156156
}
157157
flushCurrentFlag()
158158

159+
var prevBody string
160+
159161
for _, cat := range flagCategories {
160162
if buf, ok := categories[cat.name]; ok {
163+
// If the last line of the previous category is a single-line flag,
164+
// then it isn't indented, and an additional newline is necessary to
165+
// make the output readable.
166+
if prevBody != "" {
167+
prevBodyLines := strings.Split(strings.TrimSpace(prevBody), "\n")
168+
if len(prevBodyLines) > 0 {
169+
lastLine := prevBodyLines[len(prevBodyLines)-1]
170+
if strings.HasPrefix(strings.TrimSpace(lastLine), "-") {
171+
_, _ = out.WriteString("\n")
172+
}
173+
}
174+
}
175+
161176
if len(categories) == 1 {
162177
// Don't bother qualifying list if there's only one category.
163178
_, _ = fmt.Fprintf(&out, "%s\n", usageHeader("Flags:"))
@@ -166,9 +181,7 @@ func categorizeFlags(usageOutput string) string {
166181
}
167182
body := buf.String()
168183
_, _ = out.WriteString(body)
169-
if !strings.HasSuffix(body, "\n\n") {
170-
_, _ = out.WriteString("\n")
171-
}
184+
prevBody = body
172185
}
173186
}
174187

0 commit comments

Comments
 (0)