improve naming of directory-is-empty

pull/4844/head
Christian Winther 2024-01-26 20:17:54 +00:00
rodzic d372b9dee7
commit 8189b01a26
2 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -31,7 +31,7 @@ IFS=' ' read -ar skip_scripts <<< "$ENTRYPOINT_SKIP_SCRIPTS"
mkdir -p "${ENTRYPOINT_D_ROOT}"
# If ENTRYPOINT_D_ROOT directory is empty, warn and run the regular command
if is-directory-empty "${ENTRYPOINT_D_ROOT}"; then
if directory-is-empty "${ENTRYPOINT_D_ROOT}"; then
log-warning "No files found in ${ENTRYPOINT_D_ROOT}, skipping configuration"
exec "$@"

Wyświetl plik

@ -317,13 +317,14 @@ function file-exists()
{
[[ -f "$1" ]]
}
# @description Checks if $1 contains any files or not
# @arg $1 string The path to check
# @exitcode 0 If $1 contains files
# @exitcode 1 If $1 does *NOT* contain files
function is-directory-empty()
function directory-is-empty()
{
! find "${1}" -mindepth 1 -maxdepth 1 -type f -print -quit 2> /dev/null | read -r
[ -z "$(ls -A "${1}")" ]
}
# @description Ensures a directory exists (via mkdir)