From 44ab323da4b298e5ae770a1c84921d25049b75da Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 29 Sep 2021 17:37:59 +0530 Subject: gnbug: Detect bug or critical only as whole words in keywords. This is to prevent mistaken detection of the keyword "gnbug" as having "bug" in it. * gnbug (print-issue): Detect bug or critical only as whole words in keywords. --- gnbug | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gnbug') diff --git a/gnbug b/gnbug index eb8bbe5..d353cf0 100755 --- a/gnbug +++ b/gnbug @@ -334,15 +334,17 @@ List recent updates. (define (print-issue issue-number issue) "Print ISSUE with number ISSUE-NUMBER." (display (magenta (issue-title issue))) - ;; Highlight keywords containing "bug" or "critical" in red. Else, - ;; highlight in blue. + ;; Highlight keywords containing "bug" or "critical" as whole words + ;; in red. Else, highlight in blue. (unless (null? (issue-keywords issue)) (display " ") (display (string-join (map (lambda (keyword) ((cond - ((any (cut string-contains keyword <>) - (list "bug" "critical")) + ((not (null? (lset-intersection + string=? + (string-split keyword #\space) + (list "bug" "critical")))) red-background) (else blue-background)) (string-append " " keyword " "))) -- cgit v1.2.3