Rename _bashutils_restore_return method

This commit is contained in:
JeremyStar™ 2024-10-27 21:39:23 +01:00
parent f1e74c18f2
commit 7dcaaf5950
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -54,9 +54,9 @@ function _bashutils_reset_environment() {
return "${EXITCODE}" return "${EXITCODE}"
fi fi
} }
function _bashutils_restore_return() { function _bashutils_return_environment() {
_bashutils_restore_environment _bashutils_restore_environment
return "${1}" return "${1:-0}"
} }
@ -101,12 +101,12 @@ EOF
} }
# Checks # Checks
function is_command_alias() { _bashutils_reset_environment; [[ "$(type -t "${1}")" == alias ]]; _bashutils_restore_return ${?}; } function is_command_alias() { _bashutils_reset_environment; [[ "$(type -t "${1}")" == alias ]]; _bashutils_return_environment ${?}; }
function is_command_keyword() { _bashutils_reset_environment; [[ "$(type -t "${1}")" == keyword ]]; _bashutils_restore_return ${?}; } function is_command_keyword() { _bashutils_reset_environment; [[ "$(type -t "${1}")" == keyword ]]; _bashutils_return_environment ${?}; }
function is_command_function() { _bashutils_reset_environment; [[ "$(type -t "${1}")" == function ]]; _bashutils_restore_return ${?}; } function is_command_function() { _bashutils_reset_environment; [[ "$(type -t "${1}")" == function ]]; _bashutils_return_environment ${?}; }
function is_command_builtin() { _bashutils_reset_environment; [[ "$(type -t "${1}")" == builtin ]]; _bashutils_restore_return ${?}; } function is_command_builtin() { _bashutils_reset_environment; [[ "$(type -t "${1}")" == builtin ]]; _bashutils_return_environment ${?}; }
function is_command_file() { _bashutils_reset_environment; [[ "$(type -t "${1}")" == file ]]; _bashutils_restore_return ${?}; } function is_command_file() { _bashutils_reset_environment; [[ "$(type -t "${1}")" == file ]]; _bashutils_return_environment ${?}; }
function is_command_defined() { _bashutils_reset_environment; [[ "$(type -t "${1}")" == "" ]]; _bashutils_restore_return ${?}; } function is_command_defined() { _bashutils_reset_environment; [[ "$(type -t "${1}")" == "" ]]; _bashutils_return_environment ${?}; }
# Variable definition # Variable definition
function set_undefined() { _bashutils_reset_environment; [ -z "${!1}" ] && export "${1}=${2}"; _bashutils_restore_environment; } function set_undefined() { _bashutils_reset_environment; [ -z "${!1}" ] && export "${1}=${2}"; _bashutils_restore_environment; }
@ -122,4 +122,3 @@ set_undefined "BASHUTILS_LOGLEVEL" "3"
################################ ################################
### BASHUTILS CODE ENDS HERE ### ### BASHUTILS CODE ENDS HERE ###
################################ ################################