mirror of https://github.com/docker/cli.git
list/tree: Sort by created date
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
parent
18ab78882c
commit
b1a08f7841
|
@ -3,6 +3,7 @@ package image
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
|
@ -68,13 +69,19 @@ func runTree(ctx context.Context, dockerCLI command.Cli, opts treeOptions) error
|
||||||
}
|
}
|
||||||
|
|
||||||
details.ContentSize = units.HumanSizeWithPrecision(float64(totalContent), 3)
|
details.ContentSize = units.HumanSizeWithPrecision(float64(totalContent), 3)
|
||||||
|
|
||||||
view = append(view, topImage{
|
view = append(view, topImage{
|
||||||
Names: img.RepoTags,
|
Names: img.RepoTags,
|
||||||
Details: details,
|
Details: details,
|
||||||
Children: children,
|
Children: children,
|
||||||
|
created: img.Created,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sort.Slice(view, func(i, j int) bool {
|
||||||
|
return view[i].created > view[j].created
|
||||||
|
})
|
||||||
|
|
||||||
return printImageTree(dockerCLI, view)
|
return printImageTree(dockerCLI, view)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +96,8 @@ type topImage struct {
|
||||||
Names []string
|
Names []string
|
||||||
Details imageDetails
|
Details imageDetails
|
||||||
Children []subImage
|
Children []subImage
|
||||||
|
|
||||||
|
created int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type subImage struct {
|
type subImage struct {
|
||||||
|
|
Loading…
Reference in New Issue