(outs command.Streams, view treeView)
| 239 | } |
| 240 | |
| 241 | func printImageTree(outs command.Streams, view treeView) { |
| 242 | out := tui.NewOutput(outs.Out()) |
| 243 | isTerm := out.IsTerminal() |
| 244 | |
| 245 | _, width := out.GetTtySize() |
| 246 | limitWidth := width == 0 |
| 247 | if isTerm && width < 20 { |
| 248 | width = 20 |
| 249 | } |
| 250 | |
| 251 | topNameColor := out.Color(aec.NewBuilder(aec.BlueF, aec.Bold).ANSI) |
| 252 | normalColor := out.Color(tui.ColorSecondary) |
| 253 | untaggedColor := out.Color(tui.ColorTertiary) |
| 254 | titleColor := out.Color(tui.ColorTitle) |
| 255 | |
| 256 | // Legend is right-aligned, so don't print it if the width is unlimited |
| 257 | if !limitWidth { |
| 258 | out.Println(generateLegend(out, width)) |
| 259 | } |
| 260 | |
| 261 | possibleChips := getPossibleChips(view) |
| 262 | columns := []imgColumn{ |
| 263 | { |
| 264 | Title: "Image", |
| 265 | Align: alignLeft, |
| 266 | Width: 0, |
| 267 | NoEllipsis: true, |
| 268 | }, |
| 269 | { |
| 270 | Title: "ID", |
| 271 | Align: alignLeft, |
| 272 | Width: 12, |
| 273 | DetailsValue: func(d *imageDetails) string { |
| 274 | return formatter.TruncateID(d.ID) |
| 275 | }, |
| 276 | }, |
| 277 | { |
| 278 | Title: "Disk usage", |
| 279 | Align: alignRight, |
| 280 | Width: 10, |
| 281 | DetailsValue: func(d *imageDetails) string { |
| 282 | return d.DiskUsage |
| 283 | }, |
| 284 | }, |
| 285 | { |
| 286 | Title: "Content size", |
| 287 | Align: alignRight, |
| 288 | Width: 12, |
| 289 | DetailsValue: func(d *imageDetails) string { |
| 290 | return d.ContentSize |
| 291 | }, |
| 292 | }, |
| 293 | { |
| 294 | Title: "Extra", |
| 295 | Align: alignLeft, |
| 296 | Width: func() int { |
| 297 | maxChipsWidth := 0 |
| 298 | for _, chip := range possibleChips { |
searching dependent graphs…