Skip to content

Commit

Permalink
rename exitIfVariablesNotDefined to exitIfVariablesNotDeclared
Browse files Browse the repository at this point in the history
this way it is clear that we only check if it was declared
  • Loading branch information
robstoll committed Oct 18, 2024
1 parent 21cf6ec commit 57249a2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```
Expand Down
2 changes: 1 addition & 1 deletion src/utility/checks.doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 2 additions & 2 deletions src/utility/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
#
###################################
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/utility/parse-args.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}"

Expand Down
2 changes: 1 addition & 1 deletion src/utility/parse-fn-args.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]}
Expand Down

0 comments on commit 57249a2

Please sign in to comment.