@@ -32,7 +32,7 @@ const (
3232 lsHeaderDuration = "DURATION"
3333 lsHeaderLink = ""
3434
35- lsDefaultTableFormat = "table {{.Ref }}\t {{.Name}}\t {{.Status}}\t {{.CreatedAt }}\t {{.Duration}}\t {{.Link}}"
35+ lsDefaultTableFormat = "table {{.BuildID }}\t {{.Name}}\t {{.Status}}\t {{.Created }}\t {{.Duration}}\t {{.Link}}"
3636
3737 headerKeyTimestamp = "buildkit-current-timestamp"
3838)
@@ -86,7 +86,7 @@ func runLs(ctx context.Context, dockerCli command.Cli, opts lsOptions) error {
8686
8787 for i , rec := range out {
8888 st , _ := ls .ReadRef (rec .node .Builder , rec .node .Name , rec .Ref )
89- rec .Name = BuildName (rec .FrontendAttrs , st )
89+ rec .name = BuildName (rec .FrontendAttrs , st )
9090 out [i ] = rec
9191 }
9292
@@ -161,12 +161,12 @@ func lsPrint(dockerCli command.Cli, records []historyRecord, in lsOptions) error
161161 trunc : ! in .noTrunc ,
162162 }
163163 lsCtx .Header = formatter.SubHeaderContext {
164- "Ref" : lsHeaderBuildID ,
165- "Name" : lsHeaderName ,
166- "Status" : lsHeaderStatus ,
167- "CreatedAt" : lsHeaderCreated ,
168- "Duration" : lsHeaderDuration ,
169- "Link" : lsHeaderLink ,
164+ "BuildID" : lsHeaderBuildID ,
165+ "Name" : lsHeaderName ,
166+ "Status" : lsHeaderStatus ,
167+ "Created" : lsHeaderCreated ,
168+ "Duration" : lsHeaderDuration ,
169+ "Link" : lsHeaderLink ,
170170 }
171171
172172 return ctx .Write (& lsCtx , render )
@@ -186,58 +186,58 @@ func (c *lsContext) MarshalJSON() ([]byte, error) {
186186 "ref" : c .FullRef (),
187187 "name" : c .Name (),
188188 "status" : c .Status (),
189- "created_at" : c .historyRecord . CreatedAt .AsTime ().Format (time .RFC3339Nano ),
190- "total_steps" : c .historyRecord . NumTotalSteps ,
191- "completed_steps" : c .historyRecord . NumCompletedSteps ,
192- "cached_steps" : c .historyRecord . NumCachedSteps ,
189+ "created_at" : c .CreatedAt .AsTime ().Format (time .RFC3339Nano ),
190+ "total_steps" : c .NumTotalSteps ,
191+ "completed_steps" : c .NumCompletedSteps ,
192+ "cached_steps" : c .NumCachedSteps ,
193193 }
194- if c .historyRecord . CompletedAt != nil {
195- m ["completed_at" ] = c .historyRecord . CompletedAt .AsTime ().Format (time .RFC3339Nano )
194+ if c .CompletedAt != nil {
195+ m ["completed_at" ] = c .CompletedAt .AsTime ().Format (time .RFC3339Nano )
196196 }
197197 return json .Marshal (m )
198198}
199199
200- func (c * lsContext ) Ref () string {
201- return c .historyRecord . Ref
200+ func (c * lsContext ) BuildID () string {
201+ return c .Ref
202202}
203203
204204func (c * lsContext ) FullRef () string {
205- return fmt .Sprintf ("%s/%s/%s" , c .historyRecord . node .Builder , c .historyRecord . node .Name , c . historyRecord .Ref )
205+ return fmt .Sprintf ("%s/%s/%s" , c .node .Builder , c .node .Name , c .Ref )
206206}
207207
208208func (c * lsContext ) Name () string {
209- name := c .historyRecord . Name
209+ name := c .name
210210 if c .trunc && c .format .IsTable () {
211211 return trimBeginning (name , 36 )
212212 }
213213 return name
214214}
215215
216216func (c * lsContext ) Status () string {
217- if c .historyRecord . CompletedAt != nil {
218- if c .historyRecord . Error != nil {
217+ if c .CompletedAt != nil {
218+ if c .Error != nil {
219219 return "Error"
220220 }
221221 return "Completed"
222222 }
223223 return "Running"
224224}
225225
226- func (c * lsContext ) CreatedAt () string {
227- return units .HumanDuration (time .Since (c .historyRecord . CreatedAt .AsTime ())) + " ago"
226+ func (c * lsContext ) Created () string {
227+ return units .HumanDuration (time .Since (c .CreatedAt .AsTime ())) + " ago"
228228}
229229
230230func (c * lsContext ) Duration () string {
231- lastTime := c .historyRecord . currentTimestamp
232- if c .historyRecord . CompletedAt != nil {
233- tm := c .historyRecord . CompletedAt .AsTime ()
231+ lastTime := c .currentTimestamp
232+ if c .CompletedAt != nil {
233+ tm := c .CompletedAt .AsTime ()
234234 lastTime = & tm
235235 }
236236 if lastTime == nil {
237237 return ""
238238 }
239- v := formatDuration (lastTime .Sub (c .historyRecord . CreatedAt .AsTime ()))
240- if c .historyRecord . CompletedAt == nil {
239+ v := formatDuration (lastTime .Sub (c .CreatedAt .AsTime ()))
240+ if c .CompletedAt == nil {
241241 v += "+"
242242 }
243243 return v
0 commit comments