handle default list sort order through enum order

Signed-off-by: Abhilash Gnan <abhilashgnan@gmail.com>
pull/5539/head
Abhilash Gnan 6 years ago
parent 05523b5d84
commit b9a39e46de

@ -87,14 +87,14 @@ const ListAll = ListDeployed | ListUninstalled | ListUninstalling | ListPendingI
type Sorter uint type Sorter uint
const ( const (
// ByDateAsc sorts by ascending dates (oldest updated release first)
ByDateAsc Sorter = iota
// ByDateDesc sorts by descending dates (latest updated release first)
ByDateDesc
// ByNameAsc sorts by ascending lexicographic order // ByNameAsc sorts by ascending lexicographic order
ByNameAsc ByNameAsc Sorter = iota
// ByNameDesc sorts by descending lexicographic order // ByNameDesc sorts by descending lexicographic order
ByNameDesc ByNameDesc
// ByDateAsc sorts by ascending dates (oldest updated release first)
ByDateAsc
// ByDateDesc sorts by descending dates (latest updated release first)
ByDateDesc
) )
// List is the action for listing releases. // List is the action for listing releases.
@ -197,7 +197,6 @@ func (l *List) Run() ([]*release.Release, error) {
// sort is an in-place sort where order is based on the value of a.Sort // sort is an in-place sort where order is based on the value of a.Sort
func (l *List) sort(rels []*release.Release) { func (l *List) sort(rels []*release.Release) {
l.Sort = ByNameAsc
if l.SortReverse { if l.SortReverse {
l.Sort = ByNameDesc l.Sort = ByNameDesc
} }

Loading…
Cancel
Save