mirror of https://github.com/docker/cli.git
formatters(image): prevent image size from displaying scientific notation
This commit is contained in:
parent
647ccf3433
commit
a418c68e38
|
@ -248,7 +248,7 @@ func (c *imageContext) CreatedAt() string {
|
|||
}
|
||||
|
||||
func (c *imageContext) Size() string {
|
||||
return units.HumanSizeWithPrecision(float64(c.i.Size), 3)
|
||||
return units.HumanSize(float64(c.i.Size))
|
||||
}
|
||||
|
||||
func (c *imageContext) Containers() string {
|
||||
|
|
|
@ -40,6 +40,11 @@ func TestImageContext(t *testing.T) {
|
|||
expValue: "10B",
|
||||
call: ctx.Size,
|
||||
},
|
||||
{
|
||||
imageCtx: imageContext{i: types.ImageSummary{Size: 999900000}, trunc: true},
|
||||
expValue: "999.9MB",
|
||||
call: ctx.Size,
|
||||
},
|
||||
{
|
||||
imageCtx: imageContext{i: image.Summary{Created: unix}, trunc: true},
|
||||
expValue: time.Unix(unix, 0).String(), call: ctx.CreatedAt,
|
||||
|
|
Loading…
Reference in New Issue