feat: Add helper variable for optimization

This commit is contained in:
ge 2022-05-15 02:10:26 +03:00
parent 444b6df4da
commit 06c7c2349a

View File

@ -37,7 +37,7 @@ validate_sources() {
} }
validate_targets() { validate_targets() {
# Check targets array and set __main_target variable. # Check targets array and set __main_target and __main_target_path
# #
# Usage: validate_targets ARRAY # Usage: validate_targets ARRAY
@ -71,9 +71,9 @@ validate_targets() {
# Fail if __main_target's path is not a directory # Fail if __main_target's path is not a directory
parse_uri "$__main_target" parse_uri "$__main_target"
if [ -d "$path" ]; then if [ -d "$path" ]; then
__main_target="$path" __main_target_path="$path"
else else
echo "Error: Path $path in $__main_target" \ echo "Error: Path '$path' from URI '$__main_target'" \
"is not directory or does not exists" >&2 "is not directory or does not exists" >&2
exit 1 exit 1
fi fi
@ -120,4 +120,5 @@ is_function_set() {
# Usage: is_function_set FUNCTION # Usage: is_function_set FUNCTION
declare -F -- "$1" > /dev/null declare -F -- "$1" > /dev/null
return "$?"
} }