Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commitc2a182d

Browse files
committed
fixup! Migrate more logs to clog
1 parent540a957 commitc2a182d

File tree

8 files changed

+17
-14
lines changed

8 files changed

+17
-14
lines changed

‎internal/clog/error.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,6 @@ func Hint(format string, a ...interface{}) string {
131131
funcCause(formatstring,a...interface{})string {
132132
returnfmt.Sprintf("%s %s",Bold("cause:"),fmt.Sprintf(format,a...))
133133
}
134+
135+
// BlankLine is an empty string meant to be used in CLIMessage and CLIError construction.
136+
constBlankLine=""

‎internal/cmd/ceapi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func findEnv(ctx context.Context, client *coder.Client, envName, userEmail strin
7777
returnnil,clog.Fatal(
7878
"failed to find environment",
7979
fmt.Sprintf("environment %q not found in %q",envName,found),
80-
"",
80+
clog.BlankLine,
8181
clog.Tip("run\"coder envs ls\" to view your environments"),
8282
)
8383
}

‎internal/cmd/envs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ coder envs --user charlie@coder.com ls -o json \
107107
iferr=client.StopEnvironment(cmd.Context(),env.ID);err!=nil {
108108
atomic.AddInt32(&fails,1)
109109
err=clog.Fatal(fmt.Sprintf("stop environment %q",env.Name),
110-
clog.Cause(err.Error()),"",
110+
clog.Cause(err.Error()),clog.BlankLine,
111111
clog.Hint("current environment status is %q",env.LatestStat.ContainerStatus),
112112
)
113113
clog.Log(err)

‎internal/cmd/rebuild.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import (
88
"time"
99

1010
"cdr.dev/coder-cli/coder-sdk"
11+
"cdr.dev/coder-cli/internal/clog"
1112
"github.com/briandowns/spinner"
1213
"github.com/fatih/color"
1314
"github.com/manifoldco/promptui"
1415
"github.com/spf13/cobra"
15-
"go.coder.com/flog"
1616
"golang.org/x/crypto/ssh/terminal"
1717
"golang.org/x/xerrors"
1818
)
@@ -56,7 +56,10 @@ coder envs rebuild backend-env --force`,
5656
returnerr
5757
}
5858
}else {
59-
flog.Info("Use\"coder envs watch-build %s\" to follow the build logs",env.Name)
59+
clog.LogSuccess(
60+
"successfully started rebuild",
61+
clog.Tip("run\"coder envs watch-build %s\" to follow the build logs",env.Name),
62+
)
6063
}
6164
returnnil
6265
},

‎internal/cmd/secrets.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import (
1212
"cdr.dev/coder-cli/coder-sdk"
1313
"cdr.dev/coder-cli/internal/clog"
1414
"cdr.dev/coder-cli/internal/x/xtabwriter"
15-
16-
"go.coder.com/flog"
1715
)
1816

1917
funcmakeSecretsCmd()*cobra.Command {
@@ -155,7 +153,7 @@ func listSecrets(userEmail *string) func(cmd *cobra.Command, _ []string) error {
155153
}
156154

157155
iflen(secrets)<1 {
158-
flog.Info("No secrets found")
156+
clog.LogInfo("no secrets found")
159157
returnnil
160158
}
161159

‎internal/cmd/shell.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func networkErr(client *coder.Client, env *coder.Environment) error {
202202
"environment is not running",
203203
fmt.Sprintf("environment %q is not running",env.Name),
204204
fmt.Sprintf("its current status is %q",env.LatestStat.ContainerStatus),
205-
"",
205+
clog.BlankLine,
206206
clog.Tip("run\"coder envs rebuild %s --follow\" to start the environment",env.Name),
207207
)
208208
}

‎internal/cmd/sync.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ import (
99
"strings"
1010

1111
"cdr.dev/coder-cli/coder-sdk"
12+
"cdr.dev/coder-cli/internal/clog"
1213
"cdr.dev/coder-cli/internal/sync"
1314
"github.com/spf13/cobra"
1415
"golang.org/x/xerrors"
15-
16-
"go.coder.com/flog"
1716
)
1817

1918
funcmakeSyncCmd()*cobra.Command {
@@ -96,7 +95,7 @@ func makeRunSync(init *bool) func(cmd *cobra.Command, args []string) error {
9695
remoteVersion,rsyncErr:=s.Version()
9796

9897
ifrsyncErr!=nil {
99-
flog.Info("Unable to determine remote rsync version. Proceedingcautiously.")
98+
clog.LogInfo("unable to determine remote rsync version: proceedingcautiously")
10099
}elseiflocalVersion!=remoteVersion {
101100
returnxerrors.Errorf("rsync protocol mismatch: local = %s, remote = %s",localVersion,remoteVersion)
102101
}

‎internal/cmd/urls.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func makeListDevURLs(outputFmt *string) func(cmd *cobra.Command, args []string)
102102
switch*outputFmt {
103103
case"human":
104104
iflen(devURLs)<1 {
105-
flog.Info("No devURLs found for environment %q",envName)
105+
clog.LogInfo(fmt.Sprintf("no devURLs found for environment %q",envName))
106106
returnnil
107107
}
108108
err:=xtabwriter.WriteTable(len(devURLs),func(iint)interface{} {
@@ -169,13 +169,13 @@ func makeCreateDevURL() *cobra.Command {
169169

170170
urlID,found:=devURLID(portNum,urls)
171171
iffound {
172-
flog.Info("Updating devurl for port %v",port)
172+
clog.LogInfo(fmt.Sprintf("updating devurl for port %v",port))
173173
err:=client.UpdateDevURL(cmd.Context(),env.ID,urlID,portNum,urlname,access)
174174
iferr!=nil {
175175
returnxerrors.Errorf("update DevURL: %w",err)
176176
}
177177
}else {
178-
flog.Info("Adding devurl for port %v",port)
178+
clog.LogInfo(fmt.Sprintf("Adding devurl for port %v",port))
179179
err:=client.InsertDevURL(cmd.Context(),env.ID,portNum,urlname,access)
180180
iferr!=nil {
181181
returnxerrors.Errorf("insert DevURL: %w",err)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp