Skip to content

Commit 0858b6f

Browse files
committed
refactor: Rename utility functions to be private.-prefixed
1 parent 80665f9 commit 0858b6f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

pkg/src/public/bash-core.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# core.trap_remove 'some_handler' 'USR1'
1515
core.trap_add() {
1616
if ! [ ${___global_bash_core_has_init__+x} ]; then
17-
core.util.init
17+
core.private.util.init
1818
fi
1919
local function="$1"
2020

@@ -48,7 +48,7 @@ core.trap_add() {
4848
printf -v global_trap_handler_name '%q' "core.trap_handler_${signal_spec}"
4949

5050
if ! eval "$global_trap_handler_name() {
51-
core.util.trap_handler_common '$signal_spec'
51+
core.private.util.trap_handler_common '$signal_spec'
5252
}"; then
5353
core.panic 'Could not eval function'
5454
fi
@@ -68,7 +68,7 @@ core.trap_add() {
6868
# core.trap_remove 'some_handler' 'USR1'
6969
core.trap_remove() {
7070
if ! [ ${___global_bash_core_has_init__+x} ]; then
71-
core.util.init
71+
core.private.util.init
7272
fi
7373
local function="$1"
7474

@@ -130,7 +130,7 @@ core.trap_remove() {
130130
# core.shopt_pop
131131
core.shopt_push() {
132132
if ! [ ${___global_bash_core_has_init__+x} ]; then
133-
core.util.init
133+
core.private.util.init
134134
fi
135135
local shopt_action="$1"
136136
local shopt_name="$2"
@@ -177,7 +177,7 @@ core.shopt_push() {
177177
# core.shopt_pop
178178
core.shopt_pop() {
179179
if ! [ ${___global_bash_core_has_init__+x} ]; then
180-
core.util.init
180+
core.private.util.init
181181
fi
182182

183183
if (( ${#___global_shopt_stack___[@]} == 0 )); then
@@ -255,7 +255,7 @@ core.panic() {
255255
fi
256256

257257
if core.err_exists; then
258-
core.util.err_print
258+
core.private.util.err_print
259259
fi
260260
core.print_stacktrace
261261
exit "$code"
@@ -419,7 +419,7 @@ core.get_package_info() {
419419
# this function is called automatically by functions that use global variables
420420
# @noargs
421421
core.init() {
422-
core.util.init
422+
core.private.util.init
423423
}
424424

425425
# @description (DEPRECATED) Prints stacktrace

pkg/src/util/util.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# shellcheck shell=bash
22

33
# @internal
4-
core.util.init() {
4+
core.private.util.init() {
55
if [ ${___global_bash_core_has_init__+x} ]; then
66
return
77
fi
@@ -12,7 +12,7 @@ core.util.init() {
1212
}
1313

1414
# @internal
15-
core.util.trap_handler_common() {
15+
core.private.util.trap_handler_common() {
1616
local signal_spec="$1"
1717

1818
local trap_handlers=
@@ -33,7 +33,7 @@ core.util.trap_handler_common() {
3333
}
3434

3535
# @description Prints the current error stored
36-
core.util.err_print() {
36+
core.private.util.err_print() {
3737
printf '%s\n' 'Error found:'
3838
printf '%s\n' " ERRCODE: $ERRCODE" >&2
3939
printf '%s\n' " ERR: $ERR" >&2

0 commit comments

Comments
 (0)