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: 217 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))))