unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#39642] [PATCH 1/3] ui: Only display link in capable terminals.
@ 2020-02-17 13:40 Pierre Neidhardt
  2020-02-17 13:42 ` [bug#39642] [PATCH 2/3] ui: Don't disable colors when INSIDE_EMACS is set Pierre Neidhardt
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Pierre Neidhardt @ 2020-02-17 13:40 UTC (permalink / raw)
  To: 39642

From: zimoun <zimon.toutoune@gmail.com>

* guix/ui.scm (display-generation): Display generation path on new line.
* guix/scripts/describe.scm (channel-commit-hyperlink): Add TRANSFORMER argument.
(display-profile-content): Use TRANSFORMER argument to display URL explicitly
when terminal does not support hyperlinks.
---
 guix/scripts/describe.scm | 16 ++++++++++++----
 guix/ui.scm               |  2 +-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
index f13f221da9..9a7bd52163 100644
--- a/guix/scripts/describe.scm
+++ b/guix/scripts/describe.scm
@@ -201,7 +201,12 @@ way and displaying details about the channel's source code."
                    (format #t (G_ "    commit: ~a~%")
                            (if (supports-hyperlinks?)
                                (channel-commit-hyperlink channel commit)
-                               commit))))
+                               commit))
+                   (when (not (supports-hyperlinks?)
+                              )
+                     (format #t (G_ "    URL: ~a~%")
+                             (channel-commit-hyperlink channel commit
+                                                       (lambda (url msg) url))))))
                 (_ #f)))
 
             ;; Show most recently installed packages last.
@@ -233,9 +238,12 @@ way and displaying details about the channel's source code."
 
 (define* (channel-commit-hyperlink channel
                                    #:optional
-                                   (commit (channel-commit channel)))
+                                   (commit (channel-commit channel))
+                                   (transformer hyperlink))
   "Return a hyperlink for COMMIT in CHANNEL, using COMMIT as the hyperlink's
-text.  The hyperlink links to a web view of COMMIT, when available."
+text.  The hyperlink links to a web view of COMMIT, when available.
+TRANSFORMER is a procedure of 2 arguments, a URI and text, and returns a
+string for display."
   (let* ((url  (channel-url channel))
          (uri  (string->uri url))
          (host (and uri (uri-host uri))))
@@ -244,7 +252,7 @@ text.  The hyperlink links to a web view of COMMIT, when available."
           (#f
            commit)
           ((_ template)
-           (hyperlink (template url commit) commit)))
+           (transformer (template url commit) commit)))
         commit)))
 
 \f
diff --git a/guix/ui.scm b/guix/ui.scm
index dce97fb7b9..7e3251446f 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1636,7 +1636,7 @@ DURATION-RELATION with the current time."
     (let* ((file   (generation-file-name profile number))
            (link   (if (supports-hyperlinks?)
                        (cut file-hyperlink file <>)
-                       identity))
+                       (cut format #f (G_ "~a~%file: ~a") <> file)))
            (header (format #f (link (highlight (G_ "Generation ~a\t~a")))
                            number
                            (date->string
-- 
2.25.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-02-18  8:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17 13:40 [bug#39642] [PATCH 1/3] ui: Only display link in capable terminals Pierre Neidhardt
2020-02-17 13:42 ` [bug#39642] [PATCH 2/3] ui: Don't disable colors when INSIDE_EMACS is set Pierre Neidhardt
2020-02-17 13:42   ` [bug#39642] [PATCH 3/3] ui: Don't truncate search output when inside Emacs Pierre Neidhardt
2020-02-17 16:05 ` [bug#39642] [PATCH 1/3] ui: Only display link in capable terminals zimoun
2020-02-17 22:19 ` zimoun
2020-02-18  7:21   ` Pierre Neidhardt
2020-02-18  8:04     ` zimoun

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).