From 57249a245865118cfc1aeceae64a2c63a4bda4f0 Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Fri, 18 Oct 2024 15:32:41 +0200 Subject: [PATCH] rename exitIfVariablesNotDefined to exitIfVariablesNotDeclared this way it is clear that we only check if it was declared --- README.md | 2 +- src/utility/checks.doc.sh | 2 +- src/utility/checks.sh | 4 ++-- src/utility/parse-args.sh | 4 ++-- src/utility/parse-fn-args.sh | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 71e47c72..2c2f6d6b 100644 --- a/README.md +++ b/README.md @@ -1387,7 +1387,7 @@ exitIfCommandDoesNotExist "git" "please install it via https://git-scm.com/downl exitIfVarsNotAlreadySetBySource myVar1 var2 var3 declare myVar4 -exitIfVariablesNotDefined myVar4 myVar5 # would exit because myVar5 is not set +exitIfVariablesNotDeclared myVar4 myVar5 # would exit because myVar5 is not set echo "myVar4 $myVar4" ``` diff --git a/src/utility/checks.doc.sh b/src/utility/checks.doc.sh index ba490227..f7a61fa4 100644 --- a/src/utility/checks.doc.sh +++ b/src/utility/checks.doc.sh @@ -55,5 +55,5 @@ exitIfCommandDoesNotExist "git" "please install it via https://git-scm.com/downl exitIfVarsNotAlreadySetBySource myVar1 var2 var3 declare myVar4 -exitIfVariablesNotDefined myVar4 myVar5 # would exit because myVar5 is not set +exitIfVariablesNotDeclared myVar4 myVar5 # would exit because myVar5 is not set echo "myVar4 $myVar4" diff --git a/src/utility/checks.sh b/src/utility/checks.sh index b2380e4f..1e150107 100644 --- a/src/utility/checks.sh +++ b/src/utility/checks.sh @@ -71,7 +71,7 @@ # exitIfVarsNotAlreadySetBySource myVar1 var2 var3 # # declare myVar4 -# exitIfVariablesNotDefined myVar4 myVar5 # would exit because myVar5 is not set +# exitIfVariablesNotDeclared myVar4 myVar5 # would exit because myVar5 is not set # echo "myVar4 $myVar4" # ################################### @@ -300,7 +300,7 @@ function exitIfVarsNotAlreadySetBySource() { done } -function exitIfVariablesNotDefined() { +function exitIfVariablesNotDeclared() { shift 1 || traceAndDie "could not shift by 1" for variableName in "$@"; do if ! declare -p "$variableName" 2>/dev/null | grep -q 'declare --'; then diff --git a/src/utility/parse-args.sh b/src/utility/parse-args.sh index a40c0270..04037027 100644 --- a/src/utility/parse-args.sh +++ b/src/utility/parse-args.sh @@ -135,10 +135,10 @@ function parseArgumentsInternal { parse_args_exitIfParameterDefinitionIsNotTriple parseArguments_paramArr - # shellcheck disable=SC2034 # passed by name to exitIfVariablesNotDefined + # shellcheck disable=SC2034 # passed by name to exitIfVariablesNotDeclared local -a parseArguments_variableNames arrTakeEveryX parseArguments_paramArr parseArguments_variableNames 3 0 - exitIfVariablesNotDefined "${parseArguments_variableNames[@]}" + exitIfVariablesNotDeclared "${parseArguments_variableNames[@]}" local -ri parseArguments_arrLength="${#parseArguments_paramArr[@]}" diff --git a/src/utility/parse-fn-args.sh b/src/utility/parse-fn-args.sh index 07106e90..ab7cdc8a 100644 --- a/src/utility/parse-fn-args.sh +++ b/src/utility/parse-fn-args.sh @@ -127,7 +127,7 @@ function parseFnArgs() { exit 9 fi - exitIfVariablesNotDefined "${parseFnArgs_paramArr1[@]}" + exitIfVariablesNotDeclared "${parseFnArgs_paramArr1[@]}" for ((parseFnArgs_i = 0; parseFnArgs_i < parseFnArgs_minExpected; ++parseFnArgs_i)); do local parseFnArgs_name=${parseFnArgs_paramArr1[parseFnArgs_i]}