@@ -28,6 +28,7 @@ import (
2828 "strings"
2929 "time"
3030
31+ "github.com/snapcore/snapd/client"
3132 "github.com/snapcore/snapd/i18n"
3233 "github.com/snapcore/snapd/jsonutil"
3334 "github.com/snapcore/snapd/overlord/configstate"
@@ -95,22 +96,14 @@ type TaskInfo struct {
9596 Summary string `json:"summary"`
9697 Status string `json:"status"`
9798 Log []string `json:"log,omitempty"`
98- Progress TaskInfoProgress `json:"progress"`
99+ Progress client. TaskProgress `json:"progress"`
99100
100101 SpawnTime time.Time `json:"spawn-time,omitzero"`
101102 ReadyTime * time.Time `json:"ready-time,omitempty"`
102103
103104 Data map [string ]* json.RawMessage `json:"data,omitempty"`
104105}
105106
106- // TaskInfoProgress represents the progress of a task, including a label and the
107- // amount of work done out of the total.
108- type TaskInfoProgress struct {
109- Label string `json:"label"`
110- Done int `json:"done"`
111- Total int `json:"total"`
112- }
113-
114107// StateChangeToChangeInfo converts a state.Change to a ChangeInfo struct which has all
115108// the exported fields needed for JSON marshaling for `snap tasks` output. It also extracts
116109// the "api-data" from the change and includes it in the ChangeInfo.Data field.
@@ -144,7 +137,7 @@ func StateChangeToChangeInfo(chg *state.Change) *ChangeInfo {
144137 Summary : t .Summary (),
145138 Status : t .Status ().String (),
146139 Log : t .Log (),
147- Progress : TaskInfoProgress {
140+ Progress : client. TaskProgress {
148141 Label : label ,
149142 Done : done ,
150143 Total : total ,
0 commit comments