assending tasks by default
This commit is contained in:
parent
e6d9bfab2c
commit
782bd5956a
4
main.go
4
main.go
|
@ -51,7 +51,7 @@ func list(path *string) func(*cli.Cmd) {
|
||||||
cmd.Spec = "[OPTIONS]"
|
cmd.Spec = "[OPTIONS]"
|
||||||
var (
|
var (
|
||||||
asJSON = cmd.BoolOpt("json", false, "output task history as JSON")
|
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")
|
limit = cmd.IntOpt("n limit", 0, "limit the number of results by n")
|
||||||
)
|
)
|
||||||
cmd.Action = func() {
|
cmd.Action = func() {
|
||||||
|
@ -60,7 +60,7 @@ func list(path *string) func(*cli.Cmd) {
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
tasks, err := db.ReadTasks()
|
tasks, err := db.ReadTasks()
|
||||||
maybe(err)
|
maybe(err)
|
||||||
if *reverse {
|
if *assend {
|
||||||
sort.Sort(sort.Reverse(ByID(tasks)))
|
sort.Sort(sort.Reverse(ByID(tasks)))
|
||||||
}
|
}
|
||||||
if *limit > 0 && (len(tasks) > *limit) {
|
if *limit > 0 && (len(tasks) > *limit) {
|
||||||
|
|
Loading…
Reference in New Issue