From patchwork Wed Feb 9 22:17:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 37155 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D9A5B27BBEA; Wed, 9 Feb 2022 22:25:21 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 585E927BBE9 for ; Wed, 9 Feb 2022 22:25:21 +0000 (GMT) Received: from localhost ([::1]:60458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHvOq-0003yB-Hx for patchwork@mira.cbaines.net; Wed, 09 Feb 2022 17:25:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHvI9-000737-CG for guix-patches@gnu.org; Wed, 09 Feb 2022 17:18:26 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59149) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHvHm-00080G-Gh for guix-patches@gnu.org; Wed, 09 Feb 2022 17:18:24 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nHvHm-0006hK-8u for guix-patches@gnu.org; Wed, 09 Feb 2022 17:18:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53909] [PATCH 1/4] pull: '--list-generations' doesn't list package changes by default. References: <20220209221237.8549-1-ludo@gnu.org> In-Reply-To: <20220209221237.8549-1-ludo@gnu.org> Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 09 Feb 2022 22:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53909 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53909@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 53909-submit@debbugs.gnu.org id=B53909.164444504925662 (code B ref 53909); Wed, 09 Feb 2022 22:18:02 +0000 Received: (at 53909) by debbugs.gnu.org; 9 Feb 2022 22:17:29 +0000 Received: from localhost ([127.0.0.1]:53034 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHvHE-0006fp-PX for submit@debbugs.gnu.org; Wed, 09 Feb 2022 17:17:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHvHD-0006fW-9u for 53909@debbugs.gnu.org; Wed, 09 Feb 2022 17:17:28 -0500 Received: from [2001:470:142:3::e] (port=40174 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHvH8-0007vL-3a; Wed, 09 Feb 2022 17:17:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=MF/HiabR09+GoXLAMtT94CBWTz2bKXNtJSuyfRqWdkk=; b=eBRgLRJg70OEJa O393hJam+i99Ck0JH9hDZ/qUKYz+EqU7algFiKWOq2rIK9ohlFOlOshZK0JulPE9a7Mch8AN9G/Bf R0+uIT+cqbrlSwiiEjGuMmClkYIeUutw3mbxeeivO9cdLM0+zBcGg8Z7/0qnB6EkKN9+FQR6zZ3or 1HnAbjsJ7S+QOC095ypnyET1K3EfGxWeM8NY4/I66Zh9dsxdG12X7LQSO00fwvt3UmMoLPSZpmPrQ OlIkfDyMIxCEIF0a9aHxdYlJ2Kkp1url7+acs78peLXfiOt0dFVFyKBTsG+JE6hKcQ+kUAZgmI0Qw FeuWOYUpn0zMcLH7/EUw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:56742 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHvH7-0000In-KP; Wed, 09 Feb 2022 17:17:21 -0500 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Wed, 9 Feb 2022 23:17:09 +0100 Message-Id: <20220209221712.8724-1-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/scripts/pull.scm (show-help, %options): Add "--details". (process-query): Honor it. * doc/guix.texi (Invoking guix pull): Document it. --- doc/guix.texi | 15 +++++++++------ guix/scripts/pull.scm | 19 +++++++++++++++---- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 583ba1c61d..5ef750786f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4426,18 +4426,12 @@ Generation 2 Jun 11 2018 11:02:49 repository URL: https://git.savannah.gnu.org/git/guix.git branch: origin/master commit: e0cc7f669bec22c37481dd03a7941c7d11a64f1d - 2 new packages: keepalived, libnfnetlink - 6 packages upgraded: emacs-nix-mode@@2.0.4, - guile2.0-guix@@0.14.0-12.77a1aac, guix@@0.14.0-12.77a1aac, - heimdal@@7.5.0, milkytracker@@1.02.00, nix@@2.0.4 Generation 3 Jun 13 2018 23:31:07 (current) guix 844cc1c repository URL: https://git.savannah.gnu.org/git/guix.git branch: origin/master commit: 844cc1c8f394f03b404c5bb3aee086922373490c - 28 new packages: emacs-helm-ls-git, emacs-helm-mu, @dots{} - 69 packages upgraded: borg@@1.1.6, cheese@@3.28.0, @dots{} @end example @xref{Invoking guix describe, @command{guix describe}}, for other ways to @@ -4507,6 +4501,15 @@ is provided, the subset of generations that match @var{pattern}. The syntax of @var{pattern} is the same as with @code{guix package --list-generations} (@pxref{Invoking guix package}). +By default, this prints information about the channels used in each +revision as well as the corresponding news entries. If you pass +@option{--details}, it will also print the list of packages added and +upgraded in each generation compared to the previous one. + +@item --details +Instruct @option{--list-generations} to display more information about +the differences between subsequent generations---see above. + @item --roll-back @cindex rolling back @cindex undoing transactions diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index fb8ce50fa7..707f1f0929 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès +;;; Copyright © 2013-2015, 2017-2022 Ludovic Courtès ;;; Copyright © 2017 Marius Bakke ;;; Copyright © 2020, 2021 Tobias Geerinckx-Rice ;;; @@ -104,6 +104,8 @@ (define (show-help) (display (G_ " -l, --list-generations[=PATTERN] list generations matching PATTERN")) + (display (G_ " + --details show details when listing generations")) (display (G_ " --roll-back roll back to the previous generation")) (display (G_ " @@ -138,6 +140,9 @@ (define %options (lambda (opt name arg result) (cons `(query list-generations ,arg) result))) + (option '("details") #f #f + (lambda (opt name arg result) + (alist-cons 'details? #t result))) (option '("roll-back") #f #f (lambda (opt name arg result) (cons '(generation roll-back) @@ -640,17 +645,23 @@ (define (package-alist generation) (define (process-query opts profile) "Process any query on PROFILE specified by OPTS." + (define details? + (assoc-ref opts 'details?)) + (match (assoc-ref opts 'query) (('list-generations pattern) (define (list-generations profile numbers) (match numbers ((first rest ...) (display-profile-content profile first) + (let loop ((numbers numbers)) (match numbers ((first second rest ...) - (display-profile-content-diff profile - first second) + (if details? + (display-profile-content-diff profile + first second) + (display-profile-content profile second)) (display-channel-news (generation-file-name profile second) (generation-file-name profile first)) (loop (cons second rest))) @@ -754,7 +765,7 @@ (define (environment-variable) (define-command (guix-pull . args) (synopsis "pull the latest revision of Guix") - (define (no-arguments arg _‌) + (define (no-arguments arg _) (leave (G_ "~A: extraneous argument~%") arg)) (with-error-handling From patchwork Wed Feb 9 22:17:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 37152 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id AA53627BBEA; Wed, 9 Feb 2022 22:23:41 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5F3C227BBE9 for ; Wed, 9 Feb 2022 22:23:41 +0000 (GMT) Received: from localhost ([::1]:57916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHvND-0002Gu-IP for patchwork@mira.cbaines.net; Wed, 09 Feb 2022 17:23:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHvI9-000738-Cc for guix-patches@gnu.org; Wed, 09 Feb 2022 17:18:26 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59150) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHvHm-00080H-Q1 for guix-patches@gnu.org; Wed, 09 Feb 2022 17:18:24 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nHvHm-0006hS-Kt for guix-patches@gnu.org; Wed, 09 Feb 2022 17:18:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53909] [PATCH 2/4] ui: 'with-paginated-output-port' gives access to the wrapped port. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 09 Feb 2022 22:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53909 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53909@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 53909-submit@debbugs.gnu.org id=B53909.164444505325688 (code B ref 53909); Wed, 09 Feb 2022 22:18:02 +0000 Received: (at 53909) by debbugs.gnu.org; 9 Feb 2022 22:17:33 +0000 Received: from localhost ([127.0.0.1]:53040 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHvHJ-0006gE-6v for submit@debbugs.gnu.org; Wed, 09 Feb 2022 17:17:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35528) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHvHH-0006fg-Hv for 53909@debbugs.gnu.org; Wed, 09 Feb 2022 17:17:31 -0500 Received: from [2001:470:142:3::e] (port=40176 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHvHC-0007vg-Af; Wed, 09 Feb 2022 17:17:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=7mZfvdYFtUAa52+j8mx2Wy/qVs7EUoWYXZVKHW4L/d4=; b=o35N3Dy1Ya0cjwNHa46L DfVluHvuHPY/iHA+PIOZJFlbvB21H1fXG/l0dj3BVAm+TXVBgM3xs7WzHnzJoyu7UF9/sf6CQDR4n +Tnkg6g2nQ4dtAV5KDjJ/QKx+WLbXx5VkxdKR6WceilM4cSxLmMqLrRzg2Kv7lvVO4BmgJtP8WrhC +VgPynrKJg3i9CyZwKHJlBxokQBu27R4kO1KiE+8guZn4ovCPg4iSpoj6K3Ug/49s4SEn9RvXnY4e BF0516FaRgJJPJk97pjhTLCeZ5nSrh/upxp74Amtox/zpBWuK/AnPxnLSDUt9PSAd2q8SqKqmyrrM 4VXJf1CedW5QFQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:56742 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHvH8-0000In-8e; Wed, 09 Feb 2022 17:17:26 -0500 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Wed, 9 Feb 2022 23:17:10 +0100 Message-Id: <20220209221712.8724-2-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220209221712.8724-1-ludo@gnu.org> References: <20220209221712.8724-1-ludo@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/ui.scm (pager-port-mapping): New variable. (pager-wrapped-port): New procedure. (call-with-paginated-output-port): Parameterize 'pager-port-mapping'. --- guix/ui.scm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/guix/ui.scm b/guix/ui.scm index 093de1b4ab..d1f92ce7be 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -124,6 +124,7 @@ (define-module (guix ui) file-hyperlink location->hyperlink + pager-wrapped-port with-paginated-output-port relevance package-relevance @@ -1665,6 +1666,20 @@ (define (package-relevance package regexps) zero means that PACKAGE does not match any of REGEXPS." (relevance package regexps %package-metrics)) +(define pager-port-mapping + ;; If a pager is being used, via 'with-paginated-output-port', this maps the + ;; pager port (pipe) to the underlying output port. + (make-parameter #f)) + +(define* (pager-wrapped-port #:optional (port (current-output-port))) + "If PORT is a pipe to a pager created by 'with-paginated-output-port', +return the underlying port. Otherwise return #f." + (match (pager-port-mapping) + ((pager . wrapped) + (and (eq? pager port) wrapped)) + (_ + #f))) + (define* (call-with-paginated-output-port proc #:key (less-options "FrX")) (let ((pager-command-line (or (getenv "GUIX_PAGER") @@ -1691,7 +1706,10 @@ (define* (call-with-paginated-output-port proc char-set:whitespace)))))) (dynamic-wind (const #t) - (lambda () (proc pager)) + (lambda () + (parameterize ((pager-port-mapping + (cons pager (current-output-port)))) + (proc pager))) (lambda () (close-pipe pager)))) (proc (current-output-port))))) From patchwork Wed Feb 9 22:17:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 37153 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4971B27BBEA; Wed, 9 Feb 2022 22:24:56 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 14FB927BBE9 for ; Wed, 9 Feb 2022 22:24:56 +0000 (GMT) Received: from localhost ([::1]:59614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHvOQ-0003Pj-CF for patchwork@mira.cbaines.net; Wed, 09 Feb 2022 17:24:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHvI9-00073A-Cu for guix-patches@gnu.org; Wed, 09 Feb 2022 17:18:26 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59151) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHvHn-00080I-42 for guix-patches@gnu.org; Wed, 09 Feb 2022 17:18:24 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nHvHn-0006hZ-11 for guix-patches@gnu.org; Wed, 09 Feb 2022 17:18:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53909] [PATCH 3/4] ui: 'display-generation' uses color when talking to a pager. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 09 Feb 2022 22:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53909 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53909@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 53909-submit@debbugs.gnu.org id=B53909.164444505425694 (code B ref 53909); Wed, 09 Feb 2022 22:18:02 +0000 Received: (at 53909) by debbugs.gnu.org; 9 Feb 2022 22:17:34 +0000 Received: from localhost ([127.0.0.1]:53042 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHvHJ-0006gH-Ns for submit@debbugs.gnu.org; Wed, 09 Feb 2022 17:17:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35544) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHvHI-0006fi-4l for 53909@debbugs.gnu.org; Wed, 09 Feb 2022 17:17:32 -0500 Received: from [2001:470:142:3::e] (port=40178 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHvHC-0007vr-U2; Wed, 09 Feb 2022 17:17:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=ODz3vm1xqoGajyW7xf64Z3/5TVhCbIlzk1eyeOc8RVw=; b=Fo1uzSt6bCkwcC3KWmoc S2AItsgoCWfWpwRev+z0nhN7bvf3gRCxMVXfZQ+Tm7ALstB58zpGaTFWKiBQpscrx+ht6mIjWHROp WqZBmksHvvM1MYzLE+12dG1aiWCP/1LuQ4YMBlfEZ54OEMrVnPluUyB4ydurzNEF33tpS4WK/gS3W ZNM6QpP3bbzHQw2PJXwmCJwClEZaNIYCgJSa6/gFlv6N+/hGEIp8zumYk5Uc0uzwbALzj6jQLsN1d MfE0qtSk8SxbmG7Og9b3kowAel2HmMJiA+ZVHO2Pc31IsqIfAvJ7+U7TKSUoQmSCkXfFdoG2KLQBl cUwpoZITrSWXhQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:56742 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHvHC-0000In-Hh; Wed, 09 Feb 2022 17:17:26 -0500 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Wed, 9 Feb 2022 23:17:11 +0100 Message-Id: <20220209221712.8724-3-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220209221712.8724-1-ludo@gnu.org> References: <20220209221712.8724-1-ludo@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches This makes sure that, say, 'guix pull -l' benefits from colors when its output is piped to a pager, as long as the underlying terminal supports it. * guix/ui.scm (display-generation): Add second argument to 'highlight'. --- guix/ui.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/guix/ui.scm b/guix/ui.scm index d1f92ce7be..238952723e 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -1900,7 +1900,9 @@ (define (display-generation profile number) (link (if (supports-hyperlinks?) (cut file-hyperlink file <>) identity)) - (header (format #f (link (highlight (G_ "Generation ~a\t~a"))) + (header (format #f (link (highlight (G_ "Generation ~a\t~a") + (or (pager-wrapped-port) + (current-output-port)))) number (date->string (time-utc->date From patchwork Wed Feb 9 22:17:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 37154 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 6C87527BBEA; Wed, 9 Feb 2022 22:25:07 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 37E4227BBE9 for ; Wed, 9 Feb 2022 22:25:07 +0000 (GMT) Received: from localhost ([::1]:60036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHvOc-0003h7-B2 for patchwork@mira.cbaines.net; Wed, 09 Feb 2022 17:25:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHvI9-000739-CT for guix-patches@gnu.org; Wed, 09 Feb 2022 17:18:26 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59152) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHvHo-00080K-Hc for guix-patches@gnu.org; Wed, 09 Feb 2022 17:18:24 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nHvHn-0006hg-Du for guix-patches@gnu.org; Wed, 09 Feb 2022 17:18:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53909] [PATCH 4/4] pull: '--list-generations' pipes its output to the pager. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 09 Feb 2022 22:18:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53909 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53909@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 53909-submit@debbugs.gnu.org id=B53909.164444505825711 (code B ref 53909); Wed, 09 Feb 2022 22:18:03 +0000 Received: (at 53909) by debbugs.gnu.org; 9 Feb 2022 22:17:38 +0000 Received: from localhost ([127.0.0.1]:53046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHvHO-0006gc-03 for submit@debbugs.gnu.org; Wed, 09 Feb 2022 17:17:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nHvHK-0006fx-9t for 53909@debbugs.gnu.org; Wed, 09 Feb 2022 17:17:34 -0500 Received: from [2001:470:142:3::e] (port=40182 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHvHE-0007w7-FI; Wed, 09 Feb 2022 17:17:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=+Sw8ifkbZzf1pA4fy3pvvDsB1wDDj9/qPTbxggOUH0g=; b=Ssnr/XsWpKoYGUO8fgxZ M4G5QCUZjHxGykqF88Z27SUOCaxX8lX9lOgtKRlhS9+DhyEufZlZ/S/ESATeqeNs0exkARyKt7lBy QjRTl+IJnvHSBU+24Y0Q1LNTok2bJBXpSxC1EZQ7Ky6cfRUFR/M570PowhdYiCKTTJ+yfYuFLS4DU 8HkOQyecxKKdOXk0xDbVtfPPKnB7cUuAxfAhna5FVROL+fQet7l19DreqOZT+ez98g/wbG4uGO4ER xier+uAggzsPFv8pP8H4RoCzVyWD8ZAibF0HrO71lyiY6APpOFt9RStI+sHARCLhKfINKZ5IctnT7 tk71ODd55nh9Ww==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:56742 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nHvHD-0000In-5R; Wed, 09 Feb 2022 17:17:28 -0500 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Wed, 9 Feb 2022 23:17:12 +0100 Message-Id: <20220209221712.8724-4-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220209221712.8724-1-ludo@gnu.org> References: <20220209221712.8724-1-ludo@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/scripts/pull.scm (process-query): For 'list-generations queries, use 'with-paginated-output-port'. (display-news-entry-title): Pass second argument to 'highlight'. (display-news-entry): Pass second argument to 'dim'. --- guix/scripts/pull.scm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 707f1f0929..7fe738229b 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -279,7 +279,8 @@ (define title (texi->plain-text title)) ;; When Texinfo markup is invalid, display it as-is. - (const title))))))) + (const title))) + (or (pager-wrapped-port port) port))))) (define (display-news-entry entry channel language port) "Display ENTRY, a from CHANNEL, in LANGUAGE, a language @@ -291,7 +292,8 @@ (define commit (channel-news-entry-commit entry)) (display-news-entry-title entry language port) - (format port (dim (G_ " commit ~a~%")) + (format port (dim (G_ " commit ~a~%") + (or (pager-wrapped-port port) port)) (if (supports-hyperlinks?) (channel-commit-hyperlink channel commit) commit)) @@ -673,14 +675,20 @@ (define (list-generations profile numbers) (raise (condition (&profile-not-found-error (profile profile))))) ((not pattern) - (list-generations profile (profile-generations profile))) + (with-paginated-output-port port + (with-output-to-port port + (lambda () + (list-generations profile (profile-generations profile)))))) ((matching-generations pattern profile) => (match-lambda (() (exit 1)) ((numbers ...) - (list-generations profile numbers))))))) + (with-paginated-output-port port + (with-output-to-port port + (lambda () + (list-generations profile numbers)))))))))) (('display-news) (display-news profile))))