@@ -29,12 +29,12 @@ import (
29
29
"github.com/coder/coder/v2/agent/agentproc"
30
30
"github.com/coder/coder/v2/agent/reaper"
31
31
"github.com/coder/coder/v2/buildinfo"
32
- "github.com/coder/coder/v2/cli/clibase"
33
32
"github.com/coder/coder/v2/codersdk"
34
33
"github.com/coder/coder/v2/codersdk/agentsdk"
34
+ "github.com/coder/serpent"
35
35
)
36
36
37
- func (r * RootCmd )workspaceAgent ()* clibase .Cmd {
37
+ func (r * RootCmd )workspaceAgent ()* serpent .Cmd {
38
38
var (
39
39
auth string
40
40
logDir string
@@ -49,12 +49,12 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
49
49
slogJSONPath string
50
50
slogStackdriverPath string
51
51
)
52
- cmd := & clibase .Cmd {
52
+ cmd := & serpent .Cmd {
53
53
Use :"agent" ,
54
54
Short :`Starts the Coder workspace agent.` ,
55
55
// This command isn't useful to manually execute.
56
56
Hidden :true ,
57
- Handler :func (inv * clibase .Invocation )error {
57
+ Handler :func (inv * serpent .Invocation )error {
58
58
ctx ,cancel := context .WithCancel (inv .Context ())
59
59
defer cancel ()
60
60
@@ -325,69 +325,69 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
325
325
},
326
326
}
327
327
328
- cmd .Options = clibase .OptionSet {
328
+ cmd .Options = serpent .OptionSet {
329
329
{
330
330
Flag :"auth" ,
331
331
Default :"token" ,
332
332
Description :"Specify the authentication type to use for the agent." ,
333
333
Env :"CODER_AGENT_AUTH" ,
334
- Value :clibase .StringOf (& auth ),
334
+ Value :serpent .StringOf (& auth ),
335
335
},
336
336
{
337
337
Flag :"log-dir" ,
338
338
Default :os .TempDir (),
339
339
Description :"Specify the location for the agent log files." ,
340
340
Env :"CODER_AGENT_LOG_DIR" ,
341
- Value :clibase .StringOf (& logDir ),
341
+ Value :serpent .StringOf (& logDir ),
342
342
},
343
343
{
344
344
Flag :"script-data-dir" ,
345
345
Default :os .TempDir (),
346
346
Description :"Specify the location for storing script data." ,
347
347
Env :"CODER_AGENT_SCRIPT_DATA_DIR" ,
348
- Value :clibase .StringOf (& scriptDataDir ),
348
+ Value :serpent .StringOf (& scriptDataDir ),
349
349
},
350
350
{
351
351
Flag :"pprof-address" ,
352
352
Default :"127.0.0.1:6060" ,
353
353
Env :"CODER_AGENT_PPROF_ADDRESS" ,
354
- Value :clibase .StringOf (& pprofAddress ),
354
+ Value :serpent .StringOf (& pprofAddress ),
355
355
Description :"The address to serve pprof." ,
356
356
},
357
357
{
358
358
Flag :"no-reap" ,
359
359
360
360
Env :"" ,
361
361
Description :"Do not start a process reaper." ,
362
- Value :clibase .BoolOf (& noReap ),
362
+ Value :serpent .BoolOf (& noReap ),
363
363
},
364
364
{
365
365
Flag :"ssh-max-timeout" ,
366
366
// tcpip.KeepaliveIdleOption = 72h + 1min (forwardTCPSockOpts() in tailnet/conn.go)
367
367
Default :"72h" ,
368
368
Env :"CODER_AGENT_SSH_MAX_TIMEOUT" ,
369
369
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." ,
370
- Value :clibase .DurationOf (& sshMaxTimeout ),
370
+ Value :serpent .DurationOf (& sshMaxTimeout ),
371
371
},
372
372
{
373
373
Flag :"tailnet-listen-port" ,
374
374
Default :"0" ,
375
375
Env :"CODER_AGENT_TAILNET_LISTEN_PORT" ,
376
376
Description :"Specify a static port for Tailscale to use for listening." ,
377
- Value :clibase .Int64Of (& tailnetListenPort ),
377
+ Value :serpent .Int64Of (& tailnetListenPort ),
378
378
},
379
379
{
380
380
Flag :"prometheus-address" ,
381
381
Default :"127.0.0.1:2112" ,
382
382
Env :"CODER_AGENT_PROMETHEUS_ADDRESS" ,
383
- Value :clibase .StringOf (& prometheusAddress ),
383
+ Value :serpent .StringOf (& prometheusAddress ),
384
384
Description :"The bind address to serve Prometheus metrics." ,
385
385
},
386
386
{
387
387
Flag :"debug-address" ,
388
388
Default :"127.0.0.1:2113" ,
389
389
Env :"CODER_AGENT_DEBUG_ADDRESS" ,
390
- Value :clibase .StringOf (& debugAddress ),
390
+ Value :serpent .StringOf (& debugAddress ),
391
391
Description :"The bind address to serve a debug HTTP server." ,
392
392
},
393
393
{
@@ -396,23 +396,23 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
396
396
Flag :"log-human" ,
397
397
Env :"CODER_AGENT_LOGGING_HUMAN" ,
398
398
Default :"/dev/stderr" ,
399
- Value :clibase .StringOf (& slogHumanPath ),
399
+ Value :serpent .StringOf (& slogHumanPath ),
400
400
},
401
401
{
402
402
Name :"JSON Log Location" ,
403
403
Description :"Output JSON logs to a given file." ,
404
404
Flag :"log-json" ,
405
405
Env :"CODER_AGENT_LOGGING_JSON" ,
406
406
Default :"" ,
407
- Value :clibase .StringOf (& slogJSONPath ),
407
+ Value :serpent .StringOf (& slogJSONPath ),
408
408
},
409
409
{
410
410
Name :"Stackdriver Log Location" ,
411
411
Description :"Output Stackdriver compatible logs to a given file." ,
412
412
Flag :"log-stackdriver" ,
413
413
Env :"CODER_AGENT_LOGGING_STACKDRIVER" ,
414
414
Default :"" ,
415
- Value :clibase .StringOf (& slogStackdriverPath ),
415
+ Value :serpent .StringOf (& slogStackdriverPath ),
416
416
},
417
417
}
418
418