guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/05: weather: Actually show the weather.


From: guix-commits
Subject: 01/05: weather: Actually show the weather.
Date: Tue, 20 Sep 2022 13:29:08 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 818220f1ccd57d14a62f07489b0e5e21837bb3dd
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Thu Sep 15 08:51:39 2022 +0200

    weather: Actually show the weather.
    
    * guix/scripts/weather.scm (report-server-coverage): Show a weather icon.
---
 guix/scripts/weather.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm
index b7d8165262..f46c11b1a5 100644
--- a/guix/scripts/weather.scm
+++ b/guix/scripts/weather.scm
@@ -205,7 +205,6 @@ In case ITEMS is an empty list, return 1 instead."
                     #:make-progress-reporter
                     (lambda* (total #:key url #:allow-other-keys)
                       (progress-reporter/bar total)))))
-    (format #t (highlight "~a~%") server)
     (let ((obtained  (length narinfos))
           (requested (length items))
           (missing   (lset-difference string=?
@@ -224,6 +223,15 @@ In case ITEMS is an empty list, return 1 instead."
                                 (coloring-procedure (color BOLD RED)))
                                (else
                                 highlight))))
+          (format #t (highlight "~a ~a~%") server
+                  ;; This requires a Unicode-capable encoding, which we
+                  ;; restrict to UTF-8 for simplicity.
+                  (if (string=? (port-encoding (current-output-port)) "UTF-8")
+                      (cond ((> ratio 0.80) "☀")
+                            ((< ratio 0.50) "⛈")
+                            (else           "⛅"))
+                      ""))
+
           (format #t
                   (colorize (G_ "  ~,1f% substitutes available (~h out of 
~h)~%"))
                   (* 100. ratio)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]