rename binaryExists to commandExists

This commit is contained in:
Nathaniel Landau
2021-10-22 16:08:42 -04:00
parent 49468383f2
commit 04dd6d76bb
3 changed files with 7 additions and 7 deletions

View File

@@ -176,7 +176,7 @@ Utility functions for working with arrays.
Functions for validating common use-cases
- **`_binaryExists_`** Check if a binary exists in the PATH
- **`_commandExists_`** Check if a command or binary exists in the PATH
- **`_functionExists_`** Tests if a function is available in current scope
- **`_isInternetAvailable_`** Checks if Internet connections are possible
- **`_isAlpha_`** Validate that a given variable contains only alphabetic characters

View File

@@ -86,13 +86,13 @@ teardown() {
assert_failure
}
@test "_binaryExists_: true" {
run _binaryExists_ "vi"
@test "_commandExists_: true" {
run _commandExists_ "vi"
assert_success
}
@test "_binaryExists_: false" {
run _binaryExists_ "someNonexistantBinary"
@test "_commandExists_: false" {
run _commandExists_ "someNonexistantBinary"
assert_failure
}

View File

@@ -1,6 +1,6 @@
# Functions for validating common use-cases
_binaryExists_() {
_commandExists_() {
# DESC:
# Check if a binary exists in the search PATH
# ARGS:
@@ -9,7 +9,7 @@ _binaryExists_() {
# 0 if true
# 1 if false
# USAGE:
# (_binaryExists_ ffmpeg ) && [SUCCESS] || [FAILURE]
# (_commandExists_ ffmpeg ) && [SUCCESS] || [FAILURE]
[[ $# == 0 ]] && fatal "Missing required argument to ${FUNCNAME[0]}"
if ! command -v "$1" >/dev/null 2>&1; then