Message ID | 20200217134027.731-1-mail@ambrevar.xyz |
---|---|
State | Accepted |
Headers | show |
Series | [bug#39642,1/3] ui: Only display link in capable terminals. | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
Hi Pierre, Thank you for looking at. :-) On Mon, 17 Feb 2020 at 14:41, Pierre Neidhardt <mail@ambrevar.xyz> wrote: > --- > 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?) > + ) Issue on the closing parenthesis ')'. Indent? > @@ -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 I do not have tried with another 'transformer' than 'hyperlink' or 'identity'. :-) Cheers, simon
Hi Pierre, On which commit, do you apply this patch? Maybe I am doing wrong, but it is not the file 'guix/scripts/describe.scm' but instead 'guix/scripts/describe.scm'. On Mon, 17 Feb 2020 at 14:41, Pierre Neidhardt <mail@ambrevar.xyz> wrote: > 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." This does not apply on master. What do I miss? Because on my checkout, the file which is impacted is 'guix/scripts/pull.scm'. [...] > 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." This seems correct. All the best, simon
zimoun <zimon.toutoune@gmail.com> writes: > Hi Pierre, > > On which commit, do you apply this patch? > Maybe I am doing wrong, but it is not the file > 'guix/scripts/describe.scm' but instead 'guix/scripts/describe.scm'. I think you wrote this wrong! :) A few days ago, Ludo moved the code from pull.scm to describe.scm. Update master, you should see the changes.
On Tue, 18 Feb 2020 at 08:21, Pierre Neidhardt <mail@ambrevar.xyz> wrote: > A few days ago, Ludo moved the code from pull.scm to describe.scm. > Update master, you should see the changes. Right. On Tuesday 11. This old model of one way sending patches by email and other way pushing silently does not scale. Whatever! If you fix the closing parenthesis, it is fine with me. Cheers, simon
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))) 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
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(-)