From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sahitihi Subject: Re: Patch file for colorize module Date: Sat, 26 May 2018 23:52:45 +0530 Message-ID: References: <8ea5d026-fab9-7b12-198e-610ad7743cb2@swecha.net> <87r2nvjte6.fsf@elephly.net> <5ab51417-b635-9725-9f48-3bc3f9b61fdf@swecha.net> <87tvsko2wd.fsf@elephly.net> <7290013c-990d-3f7d-d8db-38e090ed766a@swecha.net> <87zi28kt82.fsf@elephly.net> <8573e97d-d107-cde6-cd17-35f4ef6d2de3@swecha.net> <87k1takumm.fsf@elephly.net> <87o9hycwl6.fsf@elephly.net> <87r2mhdeap.fsf@elephly.net> <618c131c-6ba6-e525-aefc-72acca1c910f@swecha.net> <87a7suwtp7.fsf@elephly.net> <149bfb8c-22b5-797d-e88a-ca4077b0a4cc@swecha.net> <87d0xmok8e.fsf@elephly.net> <87k1rsb9ex.fsf@elephly.net> <3e099b0b-e3ec-2bbb-6d10-5b7e48c4dff6@swecha.net> <300fd917-6742-3ef1-044d-4b0f38a44250@swecha.net> <87a7sm4v5j.fsf@elephly.net> <3d5eca09-7730-bd38-265b-7942d0ea16ed@swecha.net> <878t864i59.fsf@elephly.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------26554A3544B5B11A4455E7C4" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMdqr-0002z4-HL for guix-devel@gnu.org; Sat, 26 May 2018 14:23:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fMdqn-0001VB-E3 for guix-devel@gnu.org; Sat, 26 May 2018 14:23:37 -0400 In-Reply-To: <878t864i59.fsf@elephly.net> Content-Language: en-US List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ricardo Wurmus Cc: guix-devel@gnu.org This is a multi-part message in MIME format. --------------26554A3544B5B11A4455E7C4 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Ricardo, > I’d be happy if you could make these changes quickly and send an updated > patch. Once I receive it I’ll push it to a branch “wip-sahithi” in the > repository. > I have made the above changes. Please notify if i have to make further changes. I mean while, I will be trying out using soft-ports. Thanks ---- Sahithi --------------26554A3544B5B11A4455E7C4 Content-Type: text/x-patch; name="0001-ui-Add-support-for-colorization.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0001-ui-Add-support-for-colorization.patch" >From 64691615468bbb3e4b9e4bb2322a48c4b6a25d6d Mon Sep 17 00:00:00 2001 From: root Date: Sat, 26 May 2018 23:28:19 +0530 Subject: [PATCH] ui: Add support for colorization. * guix/ui.scm (color-table): New variable. (colorize-string): New procedure. --- guix/ui.scm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/guix/ui.scm b/guix/ui.scm index 20fbf761f..efbcbc88b 100755 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -9,7 +9,7 @@ ;;; Copyright © 2015, 2016 Mathieu Lirzin ;;; Copyright © 2016 Roel Janssen ;;; Copyright © 2016 Benz Schenk -;;; Copyright © 2013,2014 Free Software Foundation, Inc. +;;; Copyright © 2013, 2014 Free Software Foundation, Inc. ;;; Copyright © 2018 Sahithi Yarlagadda ;;; ;;; This file is part of GNU Guix. @@ -109,7 +109,6 @@ warning info guix-main - color colorize-string)) ;;; Commentary: @@ -1582,7 +1581,7 @@ and signal handling has already been set up." (initialize-guix) (apply run-guix args)) -(define ansi-color-tables +(define color-table `((CLEAR . "0") (RESET . "0") (BOLD . "1") @@ -1610,9 +1609,11 @@ and signal handling has already been set up." (ON-WHITE . "47"))) (define (color . lst) + "Returns a string containing the ANSI escape sequence for +producing the requested set of attributes. Unknown attributes are ignored." (let ((color-list (remove not - (map (lambda (color) (assq-ref ansi-color-tables color)) + (map (lambda (color) (assq-ref color-table color)) lst)))) (if (null? color-list) "" @@ -1626,5 +1627,9 @@ and signal handling has already been set up." (apply color color-list) str (color 'RESET))) + "Returns a copy of @var{str} colorized using ANSI +escape sequences according to the attributes. At the end of the returned string, the color +attributes will be reset such that subsequent output will not +have any colors in effect." ;;; ui.scm ends here -- 2.11.0 --------------26554A3544B5B11A4455E7C4--