MCPcopy
hub / github.com/docker/compose / truncateDetails

Function truncateDetails

cmd/display/tty.go:508–521  ·  cmd/display/tty.go::truncateDetails

truncateDetails tries to truncate the first line's details to reduce overflow. Returns true if any truncation was performed.

(lines []lineData, overflow int)

Source from the content-addressed store, hash-verified

506// truncateDetails tries to truncate the first line's details to reduce overflow.
507// Returns true if any truncation was performed.
508func truncateDetails(lines []lineData, overflow int) bool {
509 for i := range lines {
510 l := &lines[i]
511 if len(l.details) > 3 {
512 reduction := min(overflow, len(l.details)-3)
513 l.details = l.details[:len(l.details)-reduction-3] + "..."
514 return true
515 } else if l.details != "" {
516 l.details = ""
517 return true
518 }
519 }
520 return false
521}
522
523// truncateLongestTaskID truncates the longest taskID to reduce overflow.
524// Returns true if truncation was performed. Lengths and slicing are in runes

Callers 1

adjustLineWidthMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected