forked from toolshed/abra
fix: sort by server and type for app listing
This commit is contained in:
@ -40,6 +40,18 @@ func (a ByServer) Less(i, j int) bool {
|
||||
return strings.ToLower(a[i].File.Server) < strings.ToLower(a[j].File.Server)
|
||||
}
|
||||
|
||||
type ByServerAndType []App
|
||||
|
||||
func (a ByServerAndType) Len() int { return len(a) }
|
||||
func (a ByServerAndType) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a ByServerAndType) Less(i, j int) bool {
|
||||
if a[i].File.Server == a[j].File.Server {
|
||||
return strings.ToLower(a[i].Type) < strings.ToLower(a[j].Type)
|
||||
} else {
|
||||
return strings.ToLower(a[i].File.Server) < strings.ToLower(a[j].File.Server)
|
||||
}
|
||||
}
|
||||
|
||||
type ByType []App
|
||||
|
||||
func (a ByType) Len() int { return len(a) }
|
||||
|
Reference in New Issue
Block a user