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

Method taskList

cli/task_list.go:35–181  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33}
34
35func (r *RootCmd) taskList() *serpent.Command {
36 var (
37 statusFilter string
38 all bool
39 user string
40 quiet bool
41
42 formatter = cliui.NewOutputFormatter(
43 cliui.TableFormat(
44 []taskListRow{},
45 []string{
46 "name",
47 "status",
48 "state",
49 "state changed",
50 "message",
51 },
52 ),
53 cliui.ChangeFormatterData(
54 cliui.JSONFormat(),
55 func(data any) (any, error) {
56 rows, ok := data.([]taskListRow)
57 if !ok {
58 return nil, xerrors.Errorf("expected []taskListRow, got %T", data)
59 }
60 out := make([]codersdk.Task, len(rows))
61 for i := range rows {
62 out[i] = rows[i].Task
63 }
64 return out, nil
65 },
66 ),
67 )
68 )
69
70 cmd := &serpent.Command{
71 Use: "list",
72 Short: "List tasks",
73 Long: FormatExamples(
74 Example{
75 Description: "List tasks for the current user.",
76 Command: "coder task list",
77 },
78 Example{
79 Description: "List tasks for a specific user.",
80 Command: "coder task list --user someone-else",
81 },
82 Example{
83 Description: "List all tasks you can view.",
84 Command: "coder task list --all",
85 },
86 Example{
87 Description: "List all your running tasks.",
88 Command: "coder task list --status running",
89 },
90 Example{
91 Description: "As above, but only show IDs.",
92 Command: "coder task list --status running --quiet",

Callers 1

tasksCommandMethod · 0.95

Calls 15

InitClientMethod · 0.95
NewOutputFormatterFunction · 0.92
TableFormatFunction · 0.92
ChangeFormatterDataFunction · 0.92
JSONFormatFunction · 0.92
ToStringsFunction · 0.92
AllTaskStatusesFunction · 0.92
TaskStatusTypeAlias · 0.92
InfofFunction · 0.92
FormatExamplesFunction · 0.85
taskListRowFromTaskFunction · 0.85
TasksMethod · 0.80

Tested by

no test coverage detected