MCPcopy Index your code
hub / github.com/coder/coder / taskStatus

Method taskStatus

cli/task_status.go:15–139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13)
14
15func (r *RootCmd) taskStatus() *serpent.Command {
16 var (
17 formatter = cliui.NewOutputFormatter(
18 cliui.TableFormat(
19 []taskStatusRow{},
20 []string{
21 "state changed",
22 "status",
23 "healthy",
24 "state",
25 "message",
26 },
27 ),
28 cliui.ChangeFormatterData(
29 cliui.JSONFormat(),
30 func(data any) (any, error) {
31 rows, ok := data.([]taskStatusRow)
32 if !ok {
33 return nil, xerrors.Errorf("expected []taskStatusRow, got %T", data)
34 }
35 if len(rows) != 1 {
36 return nil, xerrors.Errorf("expected exactly 1 row, got %d", len(rows))
37 }
38 return rows[0], nil
39 },
40 ),
41 )
42 watchArg bool
43 watchIntervalArg time.Duration
44 )
45 cmd := &serpent.Command{
46 Short: "Show the status of a task.",
47 Long: FormatExamples(
48 Example{
49 Description: "Show the status of a given task.",
50 Command: "coder task status task1",
51 },
52 Example{
53 Description: "Watch the status of a given task until it completes (idle or stopped).",
54 Command: "coder task status task1 --watch",
55 },
56 ),
57 Use: "status",
58 Aliases: []string{"stat"},
59 Options: serpent.OptionSet{
60 {
61 Default: "false",
62 Description: "Watch the task status output. This will stream updates to the terminal until the underlying workspace is stopped.",
63 Flag: "watch",
64 Name: "watch",
65 Value: serpent.BoolOf(&watchArg),
66 },
67 {
68 Default: "1s",
69 Description: "Interval to poll the task for updates. Only used in tests.",
70 Hidden: true,
71 Flag: "watch-interval",
72 Name: "watch-interval",

Callers 1

tasksCommandMethod · 0.95

Calls 15

InitClientMethod · 0.95
NewOutputFormatterFunction · 0.92
TableFormatFunction · 0.92
ChangeFormatterDataFunction · 0.92
JSONFormatFunction · 0.92
FormatExamplesFunction · 0.85
toStatusRowFunction · 0.85
taskWatchIsEndedFunction · 0.85
taskStatusRowEqualFunction · 0.85
TaskByIdentifierMethod · 0.80
TaskByIDMethod · 0.80
FormatIDMethod · 0.80

Tested by

no test coverage detected