From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id cD65KTs/BGKbVwAAgWs5BA (envelope-from ) for ; Wed, 09 Feb 2022 23:24:59 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id WFAcJzs/BGKShgEA9RJhRA (envelope-from ) for ; Wed, 09 Feb 2022 23:24:59 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 511ED3A9FE for ; Wed, 9 Feb 2022 23:24:59 +0100 (CET) Received: from localhost ([::1]:59614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHvOU-0003Pj-Gk for larch@yhetil.org; Wed, 09 Feb 2022 17:24:58 -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 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644445499; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ODz3vm1xqoGajyW7xf64Z3/5TVhCbIlzk1eyeOc8RVw=; b=uFGpvpLg9fCOKDEJKAqkLtPvWdxgJQPbrH9aqKUxR426+NgqgJx/JqNKMo5/p9LiXruc20 lhYKiJsk7+UIKJmXkB+2N3ydXaEv88t301gdRKyxnqehS+6S1uRwaNHFtKL8nLf+kDP3hu 7UF+cIzzw/wZOoPTqVaxlNN72XgyP3nvq2DZGRyMR3oxUeJNFa+5VKKfc/TE2sRuUHV0ai 8d6C1JMz9NFEbZu1O4v4euLswGmrRQNN8slHYuEge7z21eH/zfFkCYRfxQgtG8v8oYLaa9 kbr5DwL7K0ZrhKlrXpP3hHVrPf3xqRmwexodkhSU1w+3DAzWD7XZXG6hfH13Lg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644445499; a=rsa-sha256; cv=none; b=OwIverk8jjqlANq38EMRGBvI0MLhrRcZ5G9wRq5aw/Nxvc1hcZ9ZUvjlZdzu16r0nBCwQd eij8y6qyMfn2f3qsZ3kaOlU6WznXM9V6D6tYCvmJw1vxrU4u9TF2vkM+WaG2JBUTY1IWln wCdQn3i3P1wt8EsySVr7a3JQbtod+bt80ZcRMEkt0dAGfPrGqIuFSHvzjHMrNpDh9eXndy hwT9vLmkTkoOnhPFYr7pwU9ksT+YvgKgbE78l6QmPYlrrKuH/PZ82IwVGkPuQjfy/Gv9sE p9USi5Bs06OGPGRA/KdHF8WLS1ppI5Y+CzbRdSF+hc3Wg5VYf6lbsun6vjXrmQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=Fo1uzSt6; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=Fo1uzSt6; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 511ED3A9FE X-Spam-Score: -2.33 X-Migadu-Scanner: scn1.migadu.com X-TUID: 3COIYeyFYxmk 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 -- 2.34.0