From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id KPOgJcjrUWI3YgAAgWs5BA (envelope-from ) for ; Sat, 09 Apr 2022 22:25:44 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id cAnXIsjrUWJNzQAA9RJhRA (envelope-from ) for ; Sat, 09 Apr 2022 22:25:44 +0200 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 2C8F61675E for ; Sat, 9 Apr 2022 22:25:44 +0200 (CEST) Received: from localhost ([::1]:45620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ndHeR-0008J1-33 for larch@yhetil.org; Sat, 09 Apr 2022 16:25:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ndHdq-0007tA-DD for guix-patches@gnu.org; Sat, 09 Apr 2022 16:25:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44853) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ndHdm-0001H4-Q0 for guix-patches@gnu.org; Sat, 09 Apr 2022 16:25:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ndHdm-0002pQ-L4 for guix-patches@gnu.org; Sat, 09 Apr 2022 16:25:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54823] [PATCH 1/3] ui: Highlight important bits in recutils output. References: <20220409202224.32040-1-ludo@gnu.org> In-Reply-To: <20220409202224.32040-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: Sat, 09 Apr 2022 20:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54823 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54823@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 54823-submit@debbugs.gnu.org id=B54823.164953585210783 (code B ref 54823); Sat, 09 Apr 2022 20:25:02 +0000 Received: (at 54823) by debbugs.gnu.org; 9 Apr 2022 20:24:12 +0000 Received: from localhost ([127.0.0.1]:38746 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ndHcx-0002nr-M3 for submit@debbugs.gnu.org; Sat, 09 Apr 2022 16:24:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39760) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ndHcv-0002nU-Co for 54823@debbugs.gnu.org; Sat, 09 Apr 2022 16:24:09 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56250) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ndHcp-000190-Rc; Sat, 09 Apr 2022 16:24:03 -0400 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=ICHw99feEkgiPdbe+BzgJuaOxLr8Mp6zvAGgvrh4eVE=; b=aNVC5GE266jo90 1llh17fSzmwVCuPYg7WaxwR1Svgi6poba8AczKtZdoD53UpTnLLF1l4VXJH8lAyJb/jevE+2gbCB5 paLIbHH7a1qoLv2l557gEgSRRi4r9F/meCCVSZEpr9LDydFOFXxqBa6SGH03Xs526faBuJ4UUy8Dr BCEmSv+aGZMySU0NCiLVg7z3c1ykd7cNPyv0LsrjClQJrFc8ShqSJexMM0w+selPKr2nwoIZgq2vS WnFdAQ2rDA2Sed+5acBIaQ/F10QTd7cAMILaxjjV/zv+0ZZvmeS7DzF3TKLCO2RY3MRNhH2XCARqJ uQUX+cZFzmtYdf2p4cvQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:58105 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 1ndHco-0004pO-KZ; Sat, 09 Apr 2022 16:24:03 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sat, 9 Apr 2022 22:23:42 +0200 Message-Id: <20220409202344.32090-1-ludo@gnu.org> X-Mailer: git-send-email 2.35.1 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-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1649535944; 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=ICHw99feEkgiPdbe+BzgJuaOxLr8Mp6zvAGgvrh4eVE=; b=phhXQiT3PkupVb6xglaALbOoLLAQh84jQuLbVaFRVhHfUXeWZZpJmaYpAeW5xzVQaVABTE YP2vmJNgvDUfr+Zi2cRB3NNOsaSa9CGbVYN5pJkB9smmv8W38hu+lpblZ+8fYk6mneWOrd fWj3Dz4hcKjbbfDj+SyCALwThpMdISG0Qx+eyyQY3zAWahgElLu9a3rxqZeiLCZOnv/g9S eUXPdE7oa5KwHIGEnGd8hWOIQp4IMvf8hBi1scAxJs3FPkqdoXK2besLqCZzec/gxBCVKM CRS0fsMQfME3Vk0Oa5EHu0JU7m+6iYRpHfL8CoRP01Dmk05v5aqfU11qWSQsqQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1649535944; a=rsa-sha256; cv=none; b=neYgzZxEf+5J/t6ERNDdYIPLNSvYZhVdQJ73Ort743Snw+H6/tiRxbD7NjQOLnjYsIDXNX vr0W5dfcewGP11klTkR+Esc0aSeYFJvfe/67o/GFQ2RysdRlVCpwuRpXXnO8ZVxeABcbUS AcT22RVwlWDTOzwX77cbrZcPtkPuJsIX9Rn1zB7jZbJNysPXiwhEQMHpFzM3Rz9NYkHF2C HGCnD+KsmRhvqhJ5z3hz85MCdN37AozQAAbCFr027rypL6OUOxlVvP+1asodH5zaZ7LZlU Rh33KF8eIq2rpnpvPyK7nluT9Gx3V9GYLyHks1NYuWePdRUzDVZExwOEMRNkCg== 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=aNVC5GE2; 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.47 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=aNVC5GE2; 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: 2C8F61675E X-Spam-Score: -2.47 X-Migadu-Scanner: scn1.migadu.com X-TUID: MTbKoips7FcA * guix/scripts/system/search.scm (service-type->recutils): Highlight the value of the 'name' field. * guix/ui.scm (package->recutils): Likewise for 'name' and 'version'. --- guix/scripts/system/search.scm | 9 +++++++-- guix/ui.scm | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/guix/scripts/system/search.scm b/guix/scripts/system/search.scm index 93c9fc5644..2a237e03d9 100644 --- a/guix/scripts/system/search.scm +++ b/guix/scripts/system/search.scm @@ -20,7 +20,7 @@ (define-module (guix scripts system search) #:use-module (guix ui) #:use-module (guix utils) - #:autoload (guix colors) (supports-hyperlinks?) + #:autoload (guix colors) (highlight supports-hyperlinks?) #:autoload (guix diagnostics) (location->hyperlink) #:use-module (gnu services) #:use-module (gnu services shepherd) @@ -74,6 +74,9 @@ (define* (service-type->recutils type port "Write to PORT a recutils record of TYPE, arranging to fit within WIDTH columns. When HYPERLINKS? is true, emit hyperlink escape sequences when appropriate." + (define port* + (or (pager-wrapped-port port) port)) + (define width* ;; The available number of columns once we've taken into account space for ;; the initial "+ " prefix. @@ -88,7 +91,9 @@ (define (extensions->recutils extensions) (string-length "extends: "))))) ;; Note: Don't i18n field names so that people can post-process it. - (format port "name: ~a~%" (service-type-name type)) + (format port "name: ~a~%" + (highlight (symbol->string (service-type-name type)) + port*)) (format port "location: ~a~%" (or (and=> (service-type-location type) (if hyperlinks? location->hyperlink location->string)) diff --git a/guix/ui.scm b/guix/ui.scm index 37d24030e4..555a614faa 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -1489,6 +1489,9 @@ (define* (package->recutils p port #:optional (width (%text-width)) "Write to PORT a `recutils' record of package P, arranging to fit within WIDTH columns. EXTRA-FIELDS is a list of symbol/value pairs to emit. When HYPERLINKS? is true, emit hyperlink escape sequences when appropriate." + (define port* + (or (pager-wrapped-port port) port)) + (define width* ;; The available number of columns once we've taken into account space for ;; the initial "+ " prefix. @@ -1508,8 +1511,8 @@ (define (package