Skip to content

Commit 76d9588

Browse files
committed
chore(cli): use external coder/serpent instead of clibase
1 parent 4604db0 commit 76d9588

File tree

126 files changed

+1441
-4867
lines changed

Some content is hidden

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

126 files changed

+1441
-4867
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
@@ -50,12 +50,12 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
5050
slogJSONPath string
5151
slogStackdriverPath string
5252
)
53-
cmd := &clibase.Cmd{
53+
cmd := &serpent.Cmd{
5454
Use: "agent",
5555
Short: `Starts the Coder workspace agent.`,
5656
// This command isn't useful to manually execute.
5757
Hidden: true,
58-
Handler: func(inv *clibase.Invocation) error {
58+
Handler: func(inv *serpent.Invocation) error {
5959
ctx, cancel := context.WithCancel(inv.Context())
6060
defer cancel()
6161

@@ -322,62 +322,62 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
322322
},
323323
}
324324

325-
cmd.Options = clibase.OptionSet{
325+
cmd.Options = serpent.OptionSet{
326326
{
327327
Flag: "auth",
328328
Default: "token",
329329
Description: "Specify the authentication type to use for the agent.",
330330
Env: "CODER_AGENT_AUTH",
331-
Value: clibase.StringOf(&auth),
331+
Value: serpent.StringOf(&auth),
332332
},
333333
{
334334
Flag: "log-dir",
335335
Default: os.TempDir(),
336336
Description: "Specify the location for the agent log files.",
337337
Env: "CODER_AGENT_LOG_DIR",
338-
Value: clibase.StringOf(&logDir),
338+
Value: serpent.StringOf(&logDir),
339339
},
340340
{
341341
Flag: "pprof-address",
342342
Default: "127.0.0.1:6060",
343343
Env: "CODER_AGENT_PPROF_ADDRESS",
344-
Value: clibase.StringOf(&pprofAddress),
344+
Value: serpent.StringOf(&pprofAddress),
345345
Description: "The address to serve pprof.",
346346
},
347347
{
348348
Flag: "no-reap",
349349

350350
Env: "",
351351
Description: "Do not start a process reaper.",
352-
Value: clibase.BoolOf(&noReap),
352+
Value: serpent.BoolOf(&noReap),
353353
},
354354
{
355355
Flag: "ssh-max-timeout",
356356
// tcpip.KeepaliveIdleOption = 72h + 1min (forwardTCPSockOpts() in tailnet/conn.go)
357357
Default: "72h",
358358
Env: "CODER_AGENT_SSH_MAX_TIMEOUT",
359359
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.",
360-
Value: clibase.DurationOf(&sshMaxTimeout),
360+
Value: serpent.DurationOf(&sshMaxTimeout),
361361
},
362362
{
363363
Flag: "tailnet-listen-port",
364364
Default: "0",
365365
Env: "CODER_AGENT_TAILNET_LISTEN_PORT",
366366
Description: "Specify a static port for Tailscale to use for listening.",
367-
Value: clibase.Int64Of(&tailnetListenPort),
367+
Value: serpent.Int64Of(&tailnetListenPort),
368368
},
369369
{
370370
Flag: "prometheus-address",
371371
Default: "127.0.0.1:2112",
372372
Env: "CODER_AGENT_PROMETHEUS_ADDRESS",
373-
Value: clibase.StringOf(&prometheusAddress),
373+
Value: serpent.StringOf(&prometheusAddress),
374374
Description: "The bind address to serve Prometheus metrics.",
375375
},
376376
{
377377
Flag: "debug-address",
378378
Default: "127.0.0.1:2113",
379379
Env: "CODER_AGENT_DEBUG_ADDRESS",
380-
Value: clibase.StringOf(&debugAddress),
380+
Value: serpent.StringOf(&debugAddress),
381381
Description: "The bind address to serve a debug HTTP server.",
382382
},
383383
{
@@ -386,23 +386,23 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
386386
Flag: "log-human",
387387
Env: "CODER_AGENT_LOGGING_HUMAN",
388388
Default: "/dev/stderr",
389-
Value: clibase.StringOf(&slogHumanPath),
389+
Value: serpent.StringOf(&slogHumanPath),
390390
},
391391
{
392392
Name: "JSON Log Location",
393393
Description: "Output JSON logs to a given file.",
394394
Flag: "log-json",
395395
Env: "CODER_AGENT_LOGGING_JSON",
396396
Default: "",
397-
Value: clibase.StringOf(&slogJSONPath),
397+
Value: serpent.StringOf(&slogJSONPath),
398398
},
399399
{
400400
Name: "Stackdriver Log Location",
401401
Description: "Output Stackdriver compatible logs to a given file.",
402402
Flag: "log-stackdriver",
403403
Env: "CODER_AGENT_LOGGING_STACKDRIVER",
404404
Default: "",
405-
Value: clibase.StringOf(&slogStackdriverPath),
405+
Value: serpent.StringOf(&slogStackdriverPath),
406406
},
407407
}
408408

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.

0 commit comments

Comments
 (0)