Skip to content

Commit

Permalink
use declare and not define in error message and mention also local
Browse files Browse the repository at this point in the history
  • Loading branch information
robstoll committed Oct 18, 2024
1 parent 9e189bd commit 2854d5d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spec/utility/parse-args_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Describe 'parse-arg.sh'
)
When run parseArguments params 'example' 'v1.0.0' -v v0.1.0
The status should be failure
The stderr should include "$(printf "you need to define the variable \033[0;36masdf\033[0m")"
The stderr should include "$(printf "you need to \`declare\` (\`local\`) the variable \033[0;36masdf\033[0m")"
End
End
End
Expand Down
2 changes: 1 addition & 1 deletion src/utility/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ 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
logError "you need to define the variable \033[0;36m%s\033[0m otherwise we write to the global scope" "$variableName"
logError "you need to \`declare\` (\`local\`) the variable \033[0;36m%s\033[0m otherwise we write to the global scope (you can also \`declare\` it in the global scope)" "$variableName"
printStackTrace
exit 1
fi
Expand Down

0 comments on commit 2854d5d

Please sign in to comment.