(out tui.Output, headers []imgColumn, img topImage, color, untaggedColor aec.ANSI)
| 432 | } |
| 433 | |
| 434 | func printNames(out tui.Output, headers []imgColumn, img topImage, color, untaggedColor aec.ANSI) { |
| 435 | if len(img.Names) == 0 { |
| 436 | _, _ = fmt.Fprint(out, headers[0].Print(untaggedColor, untaggedName)) |
| 437 | } |
| 438 | |
| 439 | for nameIdx, name := range img.Names { |
| 440 | nameWidth := tui.Width(name) |
| 441 | lastName := nameIdx == len(img.Names)-1 |
| 442 | multiLine := nameWidth > headers[0].Width |
| 443 | |
| 444 | _, _ = fmt.Fprint(out, headers[0].Print(color, name)) |
| 445 | |
| 446 | // Print each name on its own line, including the last, |
| 447 | // unless the last name fits into the column. |
| 448 | // |
| 449 | // IMAGE ID ... |
| 450 | // anImage 171e65262c80 ... |
| 451 | // firstName |
| 452 | // lastNameIsALongOne |
| 453 | // eade5be814e8 ... |
| 454 | // anotherLongName |
| 455 | // bb747ca923a5 ... |
| 456 | if !lastName || multiLine { |
| 457 | _, _ = fmt.Fprintln(out) |
| 458 | } |
| 459 | if multiLine && lastName { |
| 460 | _, _ = fmt.Fprint(out, strings.Repeat(" ", headers[0].Width)) |
| 461 | } |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | type alignment int |
| 466 |
no test coverage detected
searching dependent graphs…