@@ -33,7 +33,7 @@ const (
3333 lsHeaderDuration = "DURATION"
3434 lsHeaderLink = ""
3535
36- lsDefaultTableFormat = "table {{.Ref }}\t {{.Name}}\t {{.Status}}\t {{.CreatedAt }}\t {{.Duration}}\t {{.Link}}"
36+ lsDefaultTableFormat = "table {{.BuildID }}\t {{.Name}}\t {{.Status}}\t {{.Created }}\t {{.Duration}}\t {{.Link}}"
3737
3838 headerKeyTimestamp = "buildkit-current-timestamp"
3939)
@@ -87,7 +87,7 @@ func runLs(ctx context.Context, dockerCli command.Cli, opts lsOptions) error {
8787
8888 for i , rec := range out {
8989 st , _ := ls .ReadRef (rec .node .Builder , rec .node .Name , rec .Ref )
90- rec .Name = historyutil .BuildName (rec .FrontendAttrs , st )
90+ rec .name = historyutil .BuildName (rec .FrontendAttrs , st )
9191 out [i ] = rec
9292 }
9393
@@ -162,12 +162,12 @@ func lsPrint(dockerCli command.Cli, records []historyRecord, in lsOptions) error
162162 trunc : ! in .noTrunc ,
163163 }
164164 lsCtx .Header = formatter.SubHeaderContext {
165- "Ref" : lsHeaderBuildID ,
166- "Name" : lsHeaderName ,
167- "Status" : lsHeaderStatus ,
168- "CreatedAt" : lsHeaderCreated ,
169- "Duration" : lsHeaderDuration ,
170- "Link" : lsHeaderLink ,
165+ "BuildID" : lsHeaderBuildID ,
166+ "Name" : lsHeaderName ,
167+ "Status" : lsHeaderStatus ,
168+ "Created" : lsHeaderCreated ,
169+ "Duration" : lsHeaderDuration ,
170+ "Link" : lsHeaderLink ,
171171 }
172172
173173 return ctx .Write (& lsCtx , render )
@@ -187,58 +187,58 @@ func (c *lsContext) MarshalJSON() ([]byte, error) {
187187 "ref" : c .FullRef (),
188188 "name" : c .Name (),
189189 "status" : c .Status (),
190- "created_at" : c .historyRecord . CreatedAt .AsTime ().Format (time .RFC3339Nano ),
191- "total_steps" : c .historyRecord . NumTotalSteps ,
192- "completed_steps" : c .historyRecord . NumCompletedSteps ,
193- "cached_steps" : c .historyRecord . NumCachedSteps ,
190+ "created_at" : c .CreatedAt .AsTime ().Format (time .RFC3339Nano ),
191+ "total_steps" : c .NumTotalSteps ,
192+ "completed_steps" : c .NumCompletedSteps ,
193+ "cached_steps" : c .NumCachedSteps ,
194194 }
195- if c .historyRecord . CompletedAt != nil {
196- m ["completed_at" ] = c .historyRecord . CompletedAt .AsTime ().Format (time .RFC3339Nano )
195+ if c .CompletedAt != nil {
196+ m ["completed_at" ] = c .CompletedAt .AsTime ().Format (time .RFC3339Nano )
197197 }
198198 return json .Marshal (m )
199199}
200200
201- func (c * lsContext ) Ref () string {
202- return c .historyRecord . Ref
201+ func (c * lsContext ) BuildID () string {
202+ return c .Ref
203203}
204204
205205func (c * lsContext ) FullRef () string {
206- return fmt .Sprintf ("%s/%s/%s" , c .historyRecord . node .Builder , c .historyRecord . node .Name , c . historyRecord .Ref )
206+ return fmt .Sprintf ("%s/%s/%s" , c .node .Builder , c .node .Name , c .Ref )
207207}
208208
209209func (c * lsContext ) Name () string {
210- name := c .historyRecord . Name
210+ name := c .name
211211 if c .trunc && c .format .IsTable () {
212212 return trimBeginning (name , 36 )
213213 }
214214 return name
215215}
216216
217217func (c * lsContext ) Status () string {
218- if c .historyRecord . CompletedAt != nil {
219- if c .historyRecord . Error != nil {
218+ if c .CompletedAt != nil {
219+ if c .Error != nil {
220220 return "Error"
221221 }
222222 return "Completed"
223223 }
224224 return "Running"
225225}
226226
227- func (c * lsContext ) CreatedAt () string {
228- return units .HumanDuration (time .Since (c .historyRecord . CreatedAt .AsTime ())) + " ago"
227+ func (c * lsContext ) Created () string {
228+ return units .HumanDuration (time .Since (c .CreatedAt .AsTime ())) + " ago"
229229}
230230
231231func (c * lsContext ) Duration () string {
232- lastTime := c .historyRecord . currentTimestamp
233- if c .historyRecord . CompletedAt != nil {
234- tm := c .historyRecord . CompletedAt .AsTime ()
232+ lastTime := c .currentTimestamp
233+ if c .CompletedAt != nil {
234+ tm := c .CompletedAt .AsTime ()
235235 lastTime = & tm
236236 }
237237 if lastTime == nil {
238238 return ""
239239 }
240- v := formatDuration (lastTime .Sub (c .historyRecord . CreatedAt .AsTime ()))
241- if c .historyRecord . CompletedAt == nil {
240+ v := formatDuration (lastTime .Sub (c .CreatedAt .AsTime ()))
241+ if c .CompletedAt == nil {
242242 v += "+"
243243 }
244244 return v
0 commit comments