From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 4BB601581D3 for ; Fri, 17 May 2024 04:03:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4B3D3E2A79; Fri, 17 May 2024 04:03:52 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0B44FE2A76 for ; Fri, 17 May 2024 04:03:52 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1D00334300B for ; Fri, 17 May 2024 04:03:50 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 2D4E71AD3 for ; Fri, 17 May 2024 04:03:48 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1715827014.d3e39fba9cafdc78a92363702bcc117bf6c30a9e.sam@gentoo> Subject: [gentoo-commits] proj/gentoo-functions:master commit in: / X-VCS-Repository: proj/gentoo-functions X-VCS-Files: functions.sh X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: d3e39fba9cafdc78a92363702bcc117bf6c30a9e X-VCS-Branch: master Date: Fri, 17 May 2024 04:03:48 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 2185296f-fbb8-40f4-91c2-cb344f3c3a28 X-Archives-Hash: fcd4752154f1b0d3e24df40e98d25979 commit: d3e39fba9cafdc78a92363702bcc117bf6c30a9e Author: Kerin Millar plushkava net> AuthorDate: Thu May 16 02:32:10 2024 +0000 Commit: Sam James gentoo org> CommitDate: Thu May 16 02:36:54 2024 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=d3e39fba Declare eerror(), einfo() and ewarn() dynamically Signed-off-by: Kerin Millar plushkava.net> functions.sh | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/functions.sh b/functions.sh index dfbbe31..60fa2fa 100644 --- a/functions.sh +++ b/functions.sh @@ -56,12 +56,16 @@ eend() } # -# show an error message (with a newline) and log it +# Declare the eerror, einfo and ewarn functions. These wrap errorn, einfon and +# ewarnn respectively, the difference being that a newline is appended. # -eerror() -{ - eerrorn "${*}${genfun_newline}" -} +for _ in eerror einfo ewarn; do + eval " + $_ () { + ${_}n \"\${*}\${genfun_newline}\" + } + " +done # # show an error message (without a newline) and log it @@ -86,14 +90,6 @@ eindent() _esetdent "$(( ${#genfun_indent} + $1 ))" } -# -# show an informative message (with a newline) -# -einfo() -{ - einfon "${*}${genfun_newline}" -} - # # show an informative message (without a newline) # @@ -138,14 +134,6 @@ esyslog() fi } -# -# show a warning message (with a newline) and log it -# -ewarn() -{ - ewarnn "${*}${genfun_newline}" -} - # # show a warning message (without a newline) and log it #