Skip to content

Commit 5cedd7d

Browse files
committed
BREAKING CHANGE: refactor(functions): Rename check_ to is_
Signed-off-by: 林博仁(Buo-ren Lin) <buo.ren.lin@gmail.com>
1 parent 6724359 commit 5cedd7d

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

functions.sh

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ get_distro_categories(){
7676
#
7777
# * 0: Command exists
7878
# * 1: Command does not exist
79-
check_command_existence(){
79+
is_command_exists(){
8080
local command="${1}"
8181
if ! command -v "${command}" >/dev/null; then
8282
printf \
@@ -96,7 +96,7 @@ check_command_existence(){
9696
# * 0: All required commands are available
9797
# * 1: At least one required command is not available
9898
# * 2: Generic error
99-
check_distro_specific_required_commands(){
99+
is_distro_specific_commands_available(){
100100
local distro_id="${1}"; shift
101101
local distro_categories="${1}"; shift
102102

@@ -111,8 +111,8 @@ check_distro_specific_required_commands(){
111111
)
112112
;;
113113
*rhel*)
114-
if ! check_command_existence dnf \
115-
&& ! check_command_existence yum; then
114+
if ! is_command_exists dnf \
115+
&& ! is_command_exists yum; then
116116
flag_required_command_check_failed=true
117117
fi
118118

@@ -148,7 +148,7 @@ check_distro_specific_required_commands(){
148148
esac
149149

150150
for command in "${required_commands[@]}"; do
151-
if ! check_command_existence "${command}"; then
151+
if ! is_command_exists "${command}"; then
152152
flag_required_command_check_failed=true
153153
fi
154154
done
@@ -169,7 +169,7 @@ check_distro_specific_required_commands(){
169169
# * 0: All packages are installed
170170
# * 1: At least one package is not installed
171171
# * 2: Generic error
172-
check_archlinux_packages_installed(){
172+
is_archlinux_packages_installed(){
173173
local -a packages=("$@")
174174

175175
if test "${#packages[@]}" -eq 0; then
@@ -192,7 +192,7 @@ check_archlinux_packages_installed(){
192192
# * 0: All packages are installed
193193
# * 1: At least one package is not installed
194194
# * 2: Generic error
195-
check_debian_packages_installed(){
195+
is_debian_packages_installed(){
196196
local -a packages=("$@")
197197

198198
if test "${#packages[@]}" -eq 0; then
@@ -215,7 +215,7 @@ check_debian_packages_installed(){
215215
# * 0: All packages are installed
216216
# * 1: At least one package is not installed
217217
# * 2: Generic error
218-
check_redhat_packages_installed(){
218+
is_redhat_packages_installed(){
219219
local -a packages=("$@")
220220

221221
if test "${#packages[@]}" -eq 0; then
@@ -238,7 +238,7 @@ check_redhat_packages_installed(){
238238
# * 0: All packages are installed
239239
# * 1: At least one package is not installed
240240
# * 2: Generic error
241-
check_distro_packages_installed(){
241+
is_distro_packages_installed(){
242242
local -a packages=("$@")
243243

244244
if test "${#packages[@]}" -eq 0; then
@@ -265,15 +265,15 @@ check_distro_packages_installed(){
265265

266266
case "${distro_categories}" in
267267
*debian*)
268-
check_debian_packages_installed "${packages[@]}"
268+
is_debian_packages_installed "${packages[@]}"
269269
;;
270270
*rhel*)
271-
check_redhat_packages_installed "${packages[@]}"
271+
is_redhat_packages_installed "${packages[@]}"
272272
;;
273273
'')
274274
case "${distro_id}" in
275275
arch)
276-
check_archlinux_packages_installed "${packages[@]}"
276+
is_archlinux_packages_installed "${packages[@]}"
277277
;;
278278
*)
279279
printf \
@@ -472,7 +472,7 @@ refresh_package_manager_local_cache(){
472472
print_progress \
473473
'Refreshing the package manager local cache...'
474474

475-
if ! check_distro_specific_required_commands \
475+
if ! is_distro_specific_commands_available \
476476
"${distro_id}" \
477477
"${distro_categories}"; then
478478
printf \
@@ -615,7 +615,7 @@ switch_ubuntu_local_mirror(){
615615
# For patching APT software source definition list
616616
sed
617617
)
618-
if ! check_distro_packages_installed "${mirror_patch_dependency_pkgs[@]}"; then
618+
if ! is_distro_packages_installed "${mirror_patch_dependency_pkgs[@]}"; then
619619
printf \
620620
'Info: Installing the runtime dependencies packages for the mirror patching functionality...\n'
621621
if ! install_distro_packages "${mirror_patch_dependency_pkgs[@]}"; then
@@ -902,7 +902,7 @@ workaround_git_dubious_ownership_error(){
902902
git
903903
)
904904
if test "${#required_packages[@]}" -gt 0; then
905-
if ! check_distro_packages_installed "${required_packages[@]}"; then
905+
if ! is_distro_packages_installed "${required_packages[@]}"; then
906906
if ! install_distro_packages "${required_packages[@]}"; then
907907
printf \
908908
'Error: Unable to install the required packages for the current distribution.\n' \

0 commit comments

Comments
 (0)