From fa812a16ee052eae487059eccf730307574d1c8b Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Tue, 4 Jan 2022 08:56:19 -0500 Subject: [PATCH] fix checking hastags and nothas tags --- cmd/pttodo-cli/cli.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/pttodo-cli/cli.go b/cmd/pttodo-cli/cli.go index df198f4..3c1744e 100644 --- a/cmd/pttodo-cli/cli.go +++ b/cmd/pttodo-cli/cli.go @@ -255,14 +255,14 @@ func dump(dry bool, writer io.Writer, filepath string, tags []string, search, ro if len(tags) > 0 { result := make([]pttodo.Todo, 0, len(todos)) for _, todo := range todos { - want := len(todo.Tags) > 0 + skip := false for _, tag := range tags { positiveTag := strings.TrimLeft(tag, "-") hasTag := strings.Contains(todo.Tags, positiveTag) wantToHaveTag := !strings.HasPrefix(tag, "-") - want = want && (hasTag == wantToHaveTag) + skip = skip || !(hasTag == wantToHaveTag) } - if want { + if !skip { result = append(result, todo) } }