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) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7F6AE1581D3 for ; Tue, 14 May 2024 00:05:23 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C3A88E2A2B; Tue, 14 May 2024 00:05:22 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 A2444E2A2B for ; Tue, 14 May 2024 00:05:22 +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 CCDDB335C11 for ; Tue, 14 May 2024 00:05:21 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3646F1A35 for ; Tue, 14 May 2024 00:05:20 +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: <1715637165.7fcc1c137a79587b26db03079ee659bcbac8c533.sam@gentoo> Subject: [gentoo-commits] proj/gentoo-functions:master commit in: / X-VCS-Repository: proj/gentoo-functions X-VCS-Files: functions.sh.in X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 7fcc1c137a79587b26db03079ee659bcbac8c533 X-VCS-Branch: master Date: Tue, 14 May 2024 00:05:20 +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: b163dd61-26d8-4eb1-8017-f0b6c38a50bb X-Archives-Hash: f74eb25ec1de0fdba4c2a5daed452ab0 commit: 7fcc1c137a79587b26db03079ee659bcbac8c533 Author: Kerin Millar plushkava net> AuthorDate: Mon May 13 21:37:02 2024 +0000 Commit: Sam James gentoo org> CommitDate: Mon May 13 21:52:45 2024 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=7fcc1c13 Unify the brace style I tend to define functions in accordance with the K&R brace style. In deference to the traditions of the project, employ the Allman style instead. Signed-off-by: Kerin Millar plushkava.net> functions.sh.in | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/functions.sh.in b/functions.sh.in index d2baf5d..d1df518 100644 --- a/functions.sh.in +++ b/functions.sh.in @@ -12,7 +12,8 @@ # # Called by ebegin, eerrorn, einfon, and ewarnn. # -_eprint() { +_eprint() +{ local color msg color=$1 shift @@ -532,7 +533,8 @@ is_older_than() # permitted because the string might later be considered to be octal in an # arithmetic context, causing the shell to exit if the number be invalid. # -is_int() { +is_int() +{ set -- "${1#-}" case $1 in ''|*[!0123456789]*) @@ -554,7 +556,8 @@ is_int() { # 3) it will switch to OLDPWD if the operand is - # 4) cdable_vars causes bash to treat the operand as a potential variable name # -chdir() { +chdir() +{ if [ "$BASH" ]; then # shellcheck disable=3044 shopt -u cdable_vars @@ -569,7 +572,8 @@ chdir() { # # Determine whether the first operand contains any visible characters. # -_is_visible() { +_is_visible() +{ ! case $1 in *[[:graph:]]*) false ;; esac } @@ -584,11 +588,13 @@ is_identifier() esac ) -_has_dumb_terminal() { +_has_dumb_terminal() +{ ! case ${TERM} in *dumb*) false ;; esac } -_has_monochrome_terminal() { +_has_monochrome_terminal() +{ local colors # The tput(1) invocation is not portable, though ncurses suffices. In @@ -602,12 +608,14 @@ _has_monochrome_terminal() { fi } -_ends_with_newline() { +_ends_with_newline() +{ test "${genfun_newline}" \ && ! case $1 in *"${genfun_newline}") false ;; esac } -_update_tty_level() { +_update_tty_level() +{ # Grade the capability of the terminal attached to STDIN (if any) on a # scale of 0 to 2, assigning the resulting value to genfun_tty. If no # terminal is detected, the value shall be 0. If a dumb terminal is @@ -628,7 +636,8 @@ _update_tty_level() { fi } -_update_winsize() { +_update_winsize() +{ # The following use of stty(1) is portable as of POSIX Issue 8. It would # be beneficial to leverage the checkwinsize option in bash but the # implementation is buggy. Given that Chet has agreed to investigate, @@ -645,7 +654,8 @@ _update_winsize() { fi } -_update_cursor_coords() { +_update_cursor_coords() +{ # shellcheck disable=2046 set -- $(_ecma48_cpr) if [ "$#" -eq 2 ] && is_int "$1" && is_int "$2"; then @@ -658,7 +668,8 @@ _update_cursor_coords() { fi } -_ecma48_cpr() { +_ecma48_cpr() +{ @GENTOO_LIBEXEC_DIR@/ecma48-cpr }