ui: 'display-generation' emits a hyperlink for the generation.
* guix/ui.scm (supports-hyperlinks?): Make 'port' optional. (display-generation): Use 'file-hyperlink' for the heading when 'supports-hyperlinks?' returns true.
This commit is contained in:
parent
fa983b8257
commit
055f052574
1 changed files with 17 additions and 12 deletions
|
@ -1247,7 +1247,7 @@ documented at
|
|||
(string-append "\x1b]8;;" uri "\x1b\\"
|
||||
text "\x1b]8;;\x1b\\"))
|
||||
|
||||
(define (supports-hyperlinks? port)
|
||||
(define* (supports-hyperlinks? #:optional (port (current-output-port)))
|
||||
"Return true if PORT is a terminal that supports hyperlink escapes."
|
||||
;; Note that terminals are supposed to ignore OSC escapes they don't
|
||||
;; understand (this is the case of xterm as of version 349, for instance.)
|
||||
|
@ -1613,7 +1613,12 @@ DURATION-RELATION with the current time."
|
|||
(define (display-generation profile number)
|
||||
"Display a one-line summary of generation NUMBER of PROFILE."
|
||||
(unless (zero? number)
|
||||
(let ((header (format #f (highlight (G_ "Generation ~a\t~a")) number
|
||||
(let* ((file (generation-file-name profile number))
|
||||
(link (if (supports-hyperlinks?)
|
||||
(cut file-hyperlink file <>)
|
||||
identity))
|
||||
(header (format #f (link (highlight (G_ "Generation ~a\t~a")))
|
||||
number
|
||||
(date->string
|
||||
(time-utc->date
|
||||
(generation-time profile number))
|
||||
|
|
Reference in a new issue