aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-11-08 23:23:01 +0100
committerLudovic Courtès <ludo@gnu.org>2019-11-09 00:36:10 +0100
commitedd25a8caca7ff7184c98823845ee0d49c16916c (patch)
tree9858a6023169785b2712b70b81c5dd84e52212fa
parent7f0f38b54c98f13fed4cec1ee4785d493f29abee (diff)
downloadpatches-edd25a8caca7ff7184c98823845ee0d49c16916c.tar
patches-edd25a8caca7ff7184c98823845ee0d49c16916c.tar.gz
ui: Emit hyperlinks for 'license' in package search results.
* guix/ui.scm (package->recutils): When HYPERLINKS is true, call 'hyperlink' for the 'license' field.
-rw-r--r--guix/ui.scm9
1 files changed, 7 insertions, 2 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index bce0df5e8f..eb17d274c8 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -44,7 +44,8 @@
#:use-module (guix derivations)
#:use-module (guix build-system)
#:use-module (guix serialization)
- #:use-module ((guix licenses) #:select (license? license-name))
+ #:use-module ((guix licenses)
+ #:select (license? license-name license-uri))
#:use-module ((guix build syscalls)
#:select (free-disk-space terminal-columns
terminal-rows))
@@ -1315,7 +1316,11 @@ HYPERLINKS? is true, emit hyperlink escape sequences when appropriate."
(string-join (map license-name licenses)
", "))
((? license? license)
- (license-name license))
+ (let ((text (license-name license))
+ (uri (license-uri license)))
+ (if (and hyperlinks? uri (string-prefix? "http" uri))
+ (hyperlink uri text)
+ text)))
(x
(G_ "unknown"))))
(format port "synopsis: ~a~%"