Skip to content

Commit c428f86

Browse files
committed
chore(cli): use external coder/serpent instead of clibase
1 parent 3f65bd1 commit c428f86

File tree

124 files changed

+1430
-3516
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+1430
-3516
lines changed

cli/agent.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ import (
3131
"github.com/coder/coder/v2/agent/agentproc"
3232
"github.com/coder/coder/v2/agent/reaper"
3333
"github.com/coder/coder/v2/buildinfo"
34-
"github.com/coder/coder/v2/cli/clibase"
3534
"github.com/coder/coder/v2/codersdk"
3635
"github.com/coder/coder/v2/codersdk/agentsdk"
36+
"github.com/coder/serpent"
3737
)
3838

39-
func (r *RootCmd) workspaceAgent() *clibase.Cmd {
39+
func (r *RootCmd) workspaceAgent() *serpent.Cmd {
4040
var (
4141
auth string
4242
logDir string
@@ -51,12 +51,12 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
5151
slogJSONPath string
5252
slogStackdriverPath string
5353
)
54-
cmd := &clibase.Cmd{
54+
cmd := &serpent.Cmd{
5555
Use: "agent",
5656
Short: `Starts the Coder workspace agent.`,
5757
// This command isn't useful to manually execute.
5858
Hidden: true,
59-
Handler: func(inv *clibase.Invocation) error {
59+
Handler: func(inv *serpent.Invocation) error {
6060
ctx, cancel := context.WithCancel(inv.Context())
6161
defer cancel()
6262

@@ -326,20 +326,20 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
326326
},
327327
}
328328

329-
cmd.Options = clibase.OptionSet{
329+
cmd.Options = serpent.OptionSet{
330330
{
331331
Flag: "auth",
332332
Default: "token",
333333
Description: "Specify the authentication type to use for the agent.",
334334
Env: "CODER_AGENT_AUTH",
335-
Value: clibase.StringOf(&auth),
335+
Value: serpent.StringOf(&auth),
336336
},
337337
{
338338
Flag: "log-dir",
339339
Default: os.TempDir(),
340340
Description: "Specify the location for the agent log files.",
341341
Env: "CODER_AGENT_LOG_DIR",
342-
Value: clibase.StringOf(&logDir),
342+
Value: serpent.StringOf(&logDir),
343343
},
344344
{
345345
Flag: "script-data-dir",
@@ -352,43 +352,43 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
352352
Flag: "pprof-address",
353353
Default: "127.0.0.1:6060",
354354
Env: "CODER_AGENT_PPROF_ADDRESS",
355-
Value: clibase.StringOf(&pprofAddress),
355+
Value: serpent.StringOf(&pprofAddress),
356356
Description: "The address to serve pprof.",
357357
},
358358
{
359359
Flag: "no-reap",
360360

361361
Env: "",
362362
Description: "Do not start a process reaper.",
363-
Value: clibase.BoolOf(&noReap),
363+
Value: serpent.BoolOf(&noReap),
364364
},
365365
{
366366
Flag: "ssh-max-timeout",
367367
// tcpip.KeepaliveIdleOption = 72h + 1min (forwardTCPSockOpts() in tailnet/conn.go)
368368
Default: "72h",
369369
Env: "CODER_AGENT_SSH_MAX_TIMEOUT",
370370
Description: "Specify the max timeout for a SSH connection, it is advisable to set it to a minimum of 60s, but no more than 72h.",
371-
Value: clibase.DurationOf(&sshMaxTimeout),
371+
Value: serpent.DurationOf(&sshMaxTimeout),
372372
},
373373
{
374374
Flag: "tailnet-listen-port",
375375
Default: "0",
376376
Env: "CODER_AGENT_TAILNET_LISTEN_PORT",
377377
Description: "Specify a static port for Tailscale to use for listening.",
378-
Value: clibase.Int64Of(&tailnetListenPort),
378+
Value: serpent.Int64Of(&tailnetListenPort),
379379
},
380380
{
381381
Flag: "prometheus-address",
382382
Default: "127.0.0.1:2112",
383383
Env: "CODER_AGENT_PROMETHEUS_ADDRESS",
384-
Value: clibase.StringOf(&prometheusAddress),
384+
Value: serpent.StringOf(&prometheusAddress),
385385
Description: "The bind address to serve Prometheus metrics.",
386386
},
387387
{
388388
Flag: "debug-address",
389389
Default: "127.0.0.1:2113",
390390
Env: "CODER_AGENT_DEBUG_ADDRESS",
391-
Value: clibase.StringOf(&debugAddress),
391+
Value: serpent.StringOf(&debugAddress),
392392
Description: "The bind address to serve a debug HTTP server.",
393393
},
394394
{
@@ -397,23 +397,23 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
397397
Flag: "log-human",
398398
Env: "CODER_AGENT_LOGGING_HUMAN",
399399
Default: "/dev/stderr",
400-
Value: clibase.StringOf(&slogHumanPath),
400+
Value: serpent.StringOf(&slogHumanPath),
401401
},
402402
{
403403
Name: "JSON Log Location",
404404
Description: "Output JSON logs to a given file.",
405405
Flag: "log-json",
406406
Env: "CODER_AGENT_LOGGING_JSON",
407407
Default: "",
408-
Value: clibase.StringOf(&slogJSONPath),
408+
Value: serpent.StringOf(&slogJSONPath),
409409
},
410410
{
411411
Name: "Stackdriver Log Location",
412412
Description: "Output Stackdriver compatible logs to a given file.",
413413
Flag: "log-stackdriver",
414414
Env: "CODER_AGENT_LOGGING_STACKDRIVER",
415415
Default: "",
416-
Value: clibase.StringOf(&slogStackdriverPath),
416+
Value: serpent.StringOf(&slogStackdriverPath),
417417
},
418418
}
419419

cli/autoupdate.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@ import (
66

77
"golang.org/x/xerrors"
88

9-
"github.com/coder/coder/v2/cli/clibase"
109
"github.com/coder/coder/v2/cli/cliui"
1110
"github.com/coder/coder/v2/codersdk"
11+
"github.com/coder/serpent"
1212
)
1313

14-
func (r *RootCmd) autoupdate() *clibase.Cmd {
14+
func (r *RootCmd) autoupdate() *serpent.Cmd {
1515
client := new(codersdk.Client)
16-
cmd := &clibase.Cmd{
16+
cmd := &serpent.Cmd{
1717
Annotations: workspaceCommand,
1818
Use: "autoupdate <workspace> <always|never>",
1919
Short: "Toggle auto-update policy for a workspace",
20-
Middleware: clibase.Chain(
21-
clibase.RequireNArgs(2),
20+
Middleware: serpent.Chain(
21+
serpent.RequireNArgs(2),
2222
r.InitClient(client),
2323
),
24-
Handler: func(inv *clibase.Invocation) error {
24+
Handler: func(inv *serpent.Invocation) error {
2525
policy := strings.ToLower(inv.Args[1])
2626
err := validateAutoUpdatePolicy(policy)
2727
if err != nil {

cli/clibase/clibase.go

Lines changed: 0 additions & 80 deletions
This file was deleted.

cli/clibase/env.go

Lines changed: 0 additions & 76 deletions
This file was deleted.

cli/clibase/env_test.go

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)