summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2021-09-26 22:43:14 +0530
committerArun Isaac2021-09-26 22:43:14 +0530
commit662b0e4eae72924ef244c4d73bee4e10894d7047 (patch)
tree9c43d2ad8b39ddd454afe78df6c1dc9dbae6e273
parent039f5f7282e83d6ff1100e994b05c505f537fde8 (diff)
downloadgn-gemtext-662b0e4eae72924ef244c4d73bee4e10894d7047.tar.gz
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.
-rwxr-xr-xgnbug46
1 files 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*