Skip to content

Commit 0d01d02

Browse files
authored
fix: remove unnecessary newlines from the end of cli output (#9068)
`Infof` already adds a newline, so we don't need to as well!
1 parent 9a13814 commit 0d01d02

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

cli/exp_scaletest.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ func (r *RootCmd) scaletestCleanup() *clibase.Cmd {
427427

428428
cliui.Errorf(inv.Stderr, "Found %d scaletest workspaces\n", len(workspaces))
429429
if len(workspaces) != 0 {
430-
cliui.Infof(inv.Stdout, "Deleting scaletest workspaces..."+"\n")
430+
cliui.Infof(inv.Stdout, "Deleting scaletest workspaces...")
431431
harness := harness.NewTestHarness(cleanupStrategy.toStrategy(), harness.ConcurrentExecutionStrategy{})
432432

433433
for i, w := range workspaces {
@@ -443,7 +443,7 @@ func (r *RootCmd) scaletestCleanup() *clibase.Cmd {
443443
return xerrors.Errorf("run test harness to delete workspaces (harness failure, not a test failure): %w", err)
444444
}
445445

446-
cliui.Infof(inv.Stdout, "Done deleting scaletest workspaces:"+"\n")
446+
cliui.Infof(inv.Stdout, "Done deleting scaletest workspaces:")
447447
res := harness.Results()
448448
res.PrintText(inv.Stderr)
449449

@@ -460,7 +460,7 @@ func (r *RootCmd) scaletestCleanup() *clibase.Cmd {
460460

461461
cliui.Errorf(inv.Stderr, "Found %d scaletest users\n", len(users))
462462
if len(users) != 0 {
463-
cliui.Infof(inv.Stdout, "Deleting scaletest users..."+"\n")
463+
cliui.Infof(inv.Stdout, "Deleting scaletest users...")
464464
harness := harness.NewTestHarness(cleanupStrategy.toStrategy(), harness.ConcurrentExecutionStrategy{})
465465

466466
for i, u := range users {
@@ -479,7 +479,7 @@ func (r *RootCmd) scaletestCleanup() *clibase.Cmd {
479479
return xerrors.Errorf("run test harness to delete users (harness failure, not a test failure): %w", err)
480480
}
481481

482-
cliui.Infof(inv.Stdout, "Done deleting scaletest users:"+"\n")
482+
cliui.Infof(inv.Stdout, "Done deleting scaletest users:")
483483
res := harness.Results()
484484
res.PrintText(inv.Stderr)
485485

cli/gitaskpass.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ func (r *RootCmd) gitAskpass() *clibase.Cmd {
5151
}
5252
if token.URL != "" {
5353
if err := openURL(inv, token.URL); err == nil {
54-
cliui.Infof(inv.Stderr, "Your browser has been opened to authenticate with Git:\n\n%s\n", token.URL)
54+
cliui.Infof(inv.Stderr, "Your browser has been opened to authenticate with Git:\n%s", token.URL)
5555
} else {
56-
cliui.Infof(inv.Stderr, "Open the following URL to authenticate with Git:\n\n%s\n", token.URL)
56+
cliui.Infof(inv.Stderr, "Open the following URL to authenticate with Git:\n%s", token.URL)
5757
}
5858

5959
for r := retry.New(250*time.Millisecond, 10*time.Second); r.Wait(ctx); {
6060
token, err = client.GitAuth(ctx, host, true)
6161
if err != nil {
6262
continue
6363
}
64-
cliui.Infof(inv.Stderr, "You've been authenticated with Git!\n")
64+
cliui.Infof(inv.Stderr, "You've been authenticated with Git!")
6565
break
6666
}
6767
}

cli/publickey.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ func (r *RootCmd) publickey() *clibase.Cmd {
4545

4646
cliui.Infof(inv.Stdout,
4747
"This is your public key for using "+cliui.DefaultStyles.Field.Render("git")+" in "+
48-
"Coder. All clones with SSH will be authenticated automatically 🪄.\n\n",
48+
"Coder. All clones with SSH will be authenticated automatically 🪄.",
4949
)
50-
cliui.Infof(inv.Stdout, cliui.DefaultStyles.Code.Render(strings.TrimSpace(key.PublicKey))+"\n\n")
51-
cliui.Infof(inv.Stdout, "Add to GitHub and GitLab:"+"\n")
52-
cliui.Infof(inv.Stdout, cliui.DefaultStyles.Prompt.String()+"https://github.com/settings/ssh/new"+"\n")
53-
cliui.Infof(inv.Stdout, cliui.DefaultStyles.Prompt.String()+"https://gitlab.com/-/profile/keys"+"\n")
50+
cliui.Infof(inv.Stdout, cliui.DefaultStyles.Code.Render(strings.TrimSpace(key.PublicKey))+"\n")
51+
cliui.Infof(inv.Stdout, "Add to GitHub and GitLab:")
52+
cliui.Infof(inv.Stdout, cliui.DefaultStyles.Prompt.String()+"https://github.com/settings/ssh/new")
53+
cliui.Infof(inv.Stdout, cliui.DefaultStyles.Prompt.String()+"https://gitlab.com/-/profile/keys")
5454

5555
return nil
5656
},

cli/server.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
10301030
defer wg.Done()
10311031

10321032
if ok, _ := inv.ParsedFlags().GetBool(varVerbose); ok {
1033-
cliui.Infof(inv.Stdout, "Shutting down provisioner daemon %d...\n", id)
1033+
cliui.Infof(inv.Stdout, "Shutting down provisioner daemon %d...", id)
10341034
}
10351035
err := shutdownWithTimeout(provisionerDaemon.Shutdown, 5*time.Second)
10361036
if err != nil {
@@ -1043,7 +1043,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
10431043
return
10441044
}
10451045
if ok, _ := inv.ParsedFlags().GetBool(varVerbose); ok {
1046-
cliui.Infof(inv.Stdout, "Gracefully shut down provisioner daemon %d\n", id)
1046+
cliui.Infof(inv.Stdout, "Gracefully shut down provisioner daemon %d", id)
10471047
}
10481048
}()
10491049
}

cli/server_createadminuser.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (r *RootCmd) newCreateAdminUserCommand() *clibase.Cmd {
5151
defer cancel()
5252

5353
if newUserDBURL == "" {
54-
cliui.Infof(inv.Stdout, "Using built-in PostgreSQL (%s)\n", cfg.PostgresPath())
54+
cliui.Infof(inv.Stdout, "Using built-in PostgreSQL (%s)", cfg.PostgresPath())
5555
url, closePg, err := startBuiltinPostgres(ctx, cfg, logger)
5656
if err != nil {
5757
return err

cli/speedtest.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ func (r *RootCmd) speedtest() *clibase.Cmd {
8585
}
8686
peer := status.Peer[status.Peers()[0]]
8787
if !p2p && direct {
88-
cliui.Infof(inv.Stdout, "Waiting for a direct connection... (%dms via %s)\n", dur.Milliseconds(), peer.Relay)
88+
cliui.Infof(inv.Stdout, "Waiting for a direct connection... (%dms via %s)", dur.Milliseconds(), peer.Relay)
8989
continue
9090
}
9191
via := peer.Relay
9292
if via == "" {
9393
via = "direct"
9494
}
95-
cliui.Infof(inv.Stdout, "%dms via %s\n", dur.Milliseconds(), via)
95+
cliui.Infof(inv.Stdout, "%dms via %s", dur.Milliseconds(), via)
9696
break
9797
}
9898
} else {
@@ -107,7 +107,7 @@ func (r *RootCmd) speedtest() *clibase.Cmd {
107107
default:
108108
return xerrors.Errorf("invalid direction: %q", direction)
109109
}
110-
cliui.Infof(inv.Stdout, "Starting a %ds %s test...\n", int(duration.Seconds()), tsDir)
110+
cliui.Infof(inv.Stdout, "Starting a %ds %s test...", int(duration.Seconds()), tsDir)
111111
results, err := conn.Speedtest(ctx, tsDir, duration)
112112
if err != nil {
113113
return err

0 commit comments

Comments
 (0)