Fix error on Layer section and reduce information on one line per step.

Instead of printing out multiple lines for some steps in Layer section,
now its only printing one line while other informations can be found in
Layer details. This change also provides fix for index out of bounds
error when user scrolls through steps in Layer section and there exists
at least one step with multi-line commands.
This commit is contained in:
lightsnowball 2022-04-21 16:28:57 +00:00 committed by lightsnowball
parent c7d121b3d7
commit 4146421e60

View File

@ -2,6 +2,8 @@ package image
import (
"fmt"
"strings"
"github.com/dustin/go-humanize"
"github.com/wagoodman/dive/dive/filetree"
)
@ -39,5 +41,5 @@ func (l *Layer) String() string {
}
return fmt.Sprintf(LayerFormat,
humanize.Bytes(l.Size),
l.Command)
strings.Split(l.Command, "\n")[0])
}