Adding an option to fail upon unset env variables

This commit is contained in:
Alexey Maslennikov
2017-06-15 20:47:51 +02:00
parent 4ccfaf9d79
commit 50aa18e2a6
5 changed files with 46 additions and 18 deletions

View File

@@ -0,0 +1 @@
This will fail: Env variable not set: __NO_SUCH_VAR

9
tests/fail-not-set.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
cd "${0%/*}"
unset __NO_SUCH_VAR
echo "This will fail: {{__NO_SUCH_VAR}}" | ../mo --fail-not-set 2>&1
if [[ $? -ne 1 ]]; then
echo "Did not return 1"
fi

View File

@@ -11,6 +11,7 @@ Simple usage:
mo [--false] [--help] [--source=FILE] filenames...
--false - Treat the string "false" as empty for conditionals.
--help - This message.
--source=FILE - Load FILE into the environment before processing templates.
--fail-not-set - Fail upon expansion of an unset variable.
--false - Treat the string "false" as empty for conditionals.
--help - This message.
--source=FILE - Load FILE into the environment before processing templates.