different default sort
This commit is contained in:
parent
91e5d86ec1
commit
2c76d36be1
|
@ -16,7 +16,7 @@ func FormatTaskTable(tasks []*task.LocalTask) string {
|
||||||
return "no tasks to display\n"
|
return "no tasks to display\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Sort(task.ByDue(tasks))
|
sort.Sort(task.ByDefault(tasks))
|
||||||
|
|
||||||
var output string
|
var output string
|
||||||
for _, t := range tasks {
|
for _, t := range tasks {
|
||||||
|
|
|
@ -35,6 +35,22 @@ func (lt ByDue) Len() int { return len(lt) }
|
||||||
func (lt ByDue) Swap(i, j int) { lt[i], lt[j] = lt[j], lt[i] }
|
func (lt ByDue) Swap(i, j int) { lt[i], lt[j] = lt[j], lt[i] }
|
||||||
func (lt ByDue) Less(i, j int) bool { return lt[j].Due.After(lt[i].Due) }
|
func (lt ByDue) Less(i, j int) bool { return lt[j].Due.After(lt[i].Due) }
|
||||||
|
|
||||||
|
type ByDefault []*LocalTask
|
||||||
|
|
||||||
|
func (lt ByDefault) Len() int { return len(lt) }
|
||||||
|
func (lt ByDefault) Swap(i, j int) { lt[i], lt[j] = lt[j], lt[i] }
|
||||||
|
func (lt ByDefault) Less(i, j int) bool {
|
||||||
|
if !lt[j].Due.Equal(lt[i].Due) {
|
||||||
|
return lt[j].Due.After(lt[i].Due)
|
||||||
|
}
|
||||||
|
|
||||||
|
if lt[i].Project != lt[j].Project {
|
||||||
|
return lt[i].Project < lt[j].Project
|
||||||
|
}
|
||||||
|
|
||||||
|
return lt[i].LocalId < lt[j].LocalId
|
||||||
|
}
|
||||||
|
|
||||||
type LocalUpdate struct {
|
type LocalUpdate struct {
|
||||||
Action string
|
Action string
|
||||||
Project string
|
Project string
|
||||||
|
|
Loading…
Reference in New Issue