Allow filtering on complete/incomplete
e.g.: List all completed tasks `gask ls :x` List all incomplete tasks `gask ls :o`
This commit is contained in:
parent
1b62cbe2d8
commit
00e13fc7ad
9
model.go
9
model.go
@ -121,6 +121,15 @@ func (a *AppState) getFilterPredicate(filter string) func(todotxt.Task) bool {
|
|||||||
}
|
}
|
||||||
filterParts := strings.Split(filter, " ")
|
filterParts := strings.Split(filter, " ")
|
||||||
for _, part := range filterParts {
|
for _, part := range filterParts {
|
||||||
|
if part == ":x" {
|
||||||
|
predicates = append(predicates, func(t todotxt.Task) bool {
|
||||||
|
return t.Completed
|
||||||
|
})
|
||||||
|
} else if part == ":-x" || part == ":o" {
|
||||||
|
predicates = append(predicates, func(t todotxt.Task) bool {
|
||||||
|
return !t.Completed
|
||||||
|
})
|
||||||
|
}
|
||||||
if strings.HasPrefix(part, "@") {
|
if strings.HasPrefix(part, "@") {
|
||||||
predicates = append(predicates, func(t todotxt.Task) bool {
|
predicates = append(predicates, func(t todotxt.Task) bool {
|
||||||
for _, v := range t.Contexts {
|
for _, v := range t.Contexts {
|
||||||
|
Loading…
Reference in New Issue
Block a user