MCPcopy
hub / github.com/docker/compose / newTask

Function newTask

cmd/display/tty.go:82–103  ·  cmd/display/tty.go::newTask
(e api.Resource)

Source from the content-addressed store, hash-verified

80}
81
82func newTask(e api.Resource) task {
83 t := task{
84 ID: e.ID,
85 parents: utils.NewSet[string](),
86 startTime: time.Now(),
87 text: e.Text,
88 details: e.Details,
89 status: e.Status,
90 current: e.Current,
91 percent: e.Percent,
92 total: e.Total,
93 spinner: NewSpinner(),
94 }
95 if e.ParentID != "" {
96 t.parent = e.ParentID
97 t.parents.Add(e.ParentID)
98 }
99 if e.Status == api.Done || e.Status == api.Error {
100 t.stop()
101 }
102 return t
103}
104
105// update adjusts task state based on last received event
106func (t *task) update(e api.Resource) {

Callers 1

eventMethod · 0.85

Calls 3

stopMethod · 0.95
NewSpinnerFunction · 0.85
AddMethod · 0.45

Tested by

no test coverage detected