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 459CC1581D3 for ; Fri, 17 May 2024 04:03:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0669DE2A6F; Fri, 17 May 2024 04:03:51 +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) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D329EE2A6F for ; Fri, 17 May 2024 04:03:50 +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 9AAF93408DD for ; Fri, 17 May 2024 04:03:49 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 082921AA6 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: <1715824385.e4eab7040c9b36f5ebfc9eb0880cfd39735e4a85.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: e4eab7040c9b36f5ebfc9eb0880cfd39735e4a85 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: d035fc62-b71c-4581-ae35-16f32c4ffe84 X-Archives-Hash: 035445a0da7eeab657e233c38a0377a5 commit: e4eab7040c9b36f5ebfc9eb0880cfd39735e4a85 Author: Kerin Millar plushkava net> AuthorDate: Thu May 16 01:51:13 2024 +0000 Commit: Sam James gentoo org> CommitDate: Thu May 16 01:53:05 2024 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=e4eab704 Declare some of the v-prefixed functions dynamically Signed-off-by: Kerin Millar plushkava.net> functions.sh | 62 ++++++++++++++---------------------------------------------- 1 file changed, 14 insertions(+), 48 deletions(-) diff --git a/functions.sh b/functions.sh index 8561eb3..6647c67 100644 --- a/functions.sh +++ b/functions.sh @@ -272,12 +272,20 @@ is_older_than() read -r _ } -vebegin() -{ - if yesno "${EINFO_VERBOSE}"; then - ebegin "$@" - fi -} +# +# Declare the vebegin, veerror, veindent, veinfo, veinfon, veoutdent and +# vewarn functions. These differ from their non-v-prefixed counterparts in +# that they only have an effect where EINFO_VERBOSE is set as a truthy value. +# +for _ in vebegin veerror veindent veinfo veinfon veoutdent vewarn; do + eval " + $_ () { + if yesno \"\${EINFO_VERBOSE}\"; then + ${_#v} \"\$@\" + fi + } + " +done veend() { @@ -290,48 +298,6 @@ veend() fi } -veerror() -{ - if yesno "${EINFO_VERBOSE}"; then - eerror "$@" - fi -} - -veindent() -{ - if yesno "${EINFO_VERBOSE}"; then - eindent "$@" - fi -} - -veinfo() -{ - if yesno "${EINFO_VERBOSE}"; then - einfo "$@" - fi -} - -veinfon() -{ - if yesno "${EINFO_VERBOSE}"; then - einfon "$@" - fi -} - -veoutdent() -{ - if yesno "${EINFO_VERBOSE}"; then - eoutdent "$@" - fi -} - -vewarn() -{ - if yesno "${EINFO_VERBOSE}"; then - ewarn "$@" - fi -} - vewend() { if yesno "${EINFO_VERBOSE}"; then