commit:     4c26ae9c0b85703403a22f0e5b0b96c08cfff1f2
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Jan 25 23:36:11 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 27 08:35:40 2026 +0000
URL:        
https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=4c26ae9c

Move hr() to experimental

This commit moves the hr() function from the "functions.sh" unit to the
"experimental" module. Though I harbour no uncertainty as to whether the
function has a place in gentoo-functions at large, I find myself
concerned as to the size and scope of the core. I singled out hr()
because it depends on several private functions that could also be
extricated from the core.

Furthermore, given that pressure is mounting for an inaugural release, I
elected not to spend any time deliberating over the exact name of the
module in which hr() should reside. As such, it is only intended to
reside in the experimental module until the matter is decided upon.

There is no requirement to increment the API level, since it was already
increased to 2 by a prior commit.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>

 functions.sh              | 33 ---------------------------------
 functions/experimental.sh | 33 +++++++++++++++++++++++++++++++++
 test-functions            |  2 +-
 3 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/functions.sh b/functions.sh
index 9386912..6d9aa3b 100644
--- a/functions.sh
+++ b/functions.sh
@@ -236,39 +236,6 @@ has_systemd()
        test -d /run/systemd
 }
 
-#
-# Prints a horizontal rule. If specified, the first parameter shall be taken as
-# a string whose first character is to be repeated in the course of composing
-# the rule. Otherwise, or if specified as the empty string, it shall default to
-# the <hyphen-minus>. If specified, the second parameter shall define the 
length
-# of the rule in characters. Otherwise, it shall default to the width of the
-# terminal if such can be determined, or 80 if it cannot be.
-#
-hr()
-{
-       local c hr i length
-
-       if [ "$#" -ge 2 ] && is_int "$2"; then
-               length=$2
-       elif _update_tty_level <&1; [ "${genfun_tty}" -eq 2 ]; then
-               length=${genfun_cols}
-       else
-               length=80
-       fi
-       c=${1--}
-       c=${c%"${c#?}"}
-       hr=
-       i=0
-       while [ "$(( i += 16 ))" -le "${length}" ]; do
-               
hr=${hr}${c}${c}${c}${c}${c}${c}${c}${c}${c}${c}${c}${c}${c}${c}${c}${c}
-       done
-       i=${#hr}
-       while [ "$(( i += 1 ))" -le "${length}" ]; do
-               hr=${hr}${c}
-       done
-       printf '%s\n' "${hr}"
-}
-
 #
 # Determines whether the first parameter is a valid identifier (variable name).
 #

diff --git a/functions/experimental.sh b/functions/experimental.sh
index d3e2e3a..1cbebf3 100644
--- a/functions/experimental.sh
+++ b/functions/experimental.sh
@@ -54,6 +54,39 @@ fetch()
        fetch "$@"
 }
 
+#
+# Prints a horizontal rule. If specified, the first parameter shall be taken as
+# a string whose first character is to be repeated in the course of composing
+# the rule. Otherwise, or if specified as the empty string, it shall default to
+# the <hyphen-minus>. If specified, the second parameter shall define the 
length
+# of the rule in characters. Otherwise, it shall default to the width of the
+# terminal if such can be determined, or 80 if it cannot be.
+#
+hr()
+{
+       local c hr i length
+
+       if [ "$#" -ge 2 ] && is_int "$2"; then
+               length=$2
+       elif _update_tty_level <&1; [ "${genfun_tty}" -eq 2 ]; then
+               length=${genfun_cols}
+       else
+               length=80
+       fi
+       c=${1--}
+       c=${c%"${c#?}"}
+       hr=
+       i=0
+       while [ "$(( i += 16 ))" -le "${length}" ]; do
+               
hr=${hr}${c}${c}${c}${c}${c}${c}${c}${c}${c}${c}${c}${c}${c}${c}${c}${c}
+       done
+       i=${#hr}
+       while [ "$(( i += 1 ))" -le "${length}" ]; do
+               hr=${hr}${c}
+       done
+       printf '%s\n' "${hr}"
+}
+
 #
 # Expects three parameters, all of which must be integers, and determines
 # whether the first is numerically greater than or equal to the second, and

diff --git a/test-functions b/test-functions
index 641ac93..0e5561c 100755
--- a/test-functions
+++ b/test-functions
@@ -1260,7 +1260,7 @@ else
        test_newest || rc=1
        test_oldest || rc=1
        test_trim || rc=1
-       test_hr || rc=1
+       #test_hr || rc=1
        test_whenceforth || rc=1
        test_parallel_run || rc=1
        test_is_anyof || rc=1

Reply via email to