assending tasks by default

This commit is contained in:
Kevin Schoon 2018-01-21 01:24:48 +08:00
parent e6d9bfab2c
commit 782bd5956a
1 changed files with 4 additions and 4 deletions

View File

@ -51,7 +51,7 @@ func list(path *string) func(*cli.Cmd) {
cmd.Spec = "[OPTIONS]"
var (
asJSON = cmd.BoolOpt("json", false, "output task history as JSON")
reverse = cmd.BoolOpt("r reverse", false, "sort tasks assending in age")
assend = cmd.BoolOpt("assend", true, "sort tasks assending in age")
limit = cmd.IntOpt("n limit", 0, "limit the number of results by n")
)
cmd.Action = func() {
@ -60,7 +60,7 @@ func list(path *string) func(*cli.Cmd) {
defer db.Close()
tasks, err := db.ReadTasks()
maybe(err)
if *reverse {
if *assend {
sort.Sort(sort.Reverse(ByID(tasks)))
}
if *limit > 0 && (len(tasks) > *limit) {