From 662b0e4eae72924ef244c4d73bee4e10894d7047 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 26 Sep 2021 22:43:14 +0530 Subject: gnbug: Update issue listing format. This new 2-line issue listing format closely imitates GitHub's issue listing format, and provides more space to display more issue fields. * gnbug (print-issue): Update issue printing format. --- gnbug | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/gnbug b/gnbug index becc39f..7b933e3 100755 --- a/gnbug +++ b/gnbug @@ -291,24 +291,34 @@ List recent updates. (define (print-issue issue-number issue) "Print ISSUE with number ISSUE-NUMBER." - (format #t "~a ~a ~a ~a~a~a~%" - (magenta (string-append "#" (number->string issue-number))) - (issue-created-relative-date issue) - (cyan (issue-creator issue)) - (issue-title issue) - (match (issue-keywords issue) - (() "") - (keywords - (blue - (string-append " [" - (string-join keywords ", ") - "]")))) - (match (issue-assigned issue) - (() "") - (assignees - (magenta (string-append " (assigned: " - (string-join assignees ", ") - ")")))))) + (display (magenta (issue-title issue))) + ;; Highlight keywords containing "bug" or "critical" 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")) + red-background) + (else blue-background)) + (string-append " " keyword " "))) + (issue-keywords issue)) + " "))) + (unless (null? (issue-assigned issue)) + (display (green (string-append " (assigned: " + (string-join (issue-assigned issue) + ", ") + ")")))) + (newline) + (display (string-append + (cyan (string-append "#" (number->string issue-number))) + " opened " + (cyan (issue-created-relative-date issue)) + " by " + (cyan (issue-creator issue)))) + (newline)) (define gnbug-list (match-lambda* -- cgit v1.2.3