mirror of
https://github.com/tests-always-included/mo.git
synced 2025-11-19 23:34:32 +01:00
Enabling a "false is empty" style check.
This is based off of pull request #10 from @athieriot. Thanks for the idea! I've implemented it as a flag and an environment variable that can be enabled. I've also added another test to handle the environment variable.
This commit is contained in:
1
tests/false-is-empty-arg.expected
Normal file
1
tests/false-is-empty-arg.expected
Normal file
@@ -0,0 +1 @@
|
||||
The user j.doe exists.
|
||||
4
tests/false-is-empty-arg.sh
Executable file
4
tests/false-is-empty-arg.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd "${0%/*}"
|
||||
USER=j.doe ADMIN=false ../mo --false false-is-empty-arg.template
|
||||
4
tests/false-is-empty-arg.template
Normal file
4
tests/false-is-empty-arg.template
Normal file
@@ -0,0 +1,4 @@
|
||||
The user {{USER}} exists.
|
||||
{{#ADMIN}}
|
||||
WRONG - should not be an admin.
|
||||
{{/ADMIN}}
|
||||
2
tests/false-is-empty-env.env
Normal file
2
tests/false-is-empty-env.env
Normal file
@@ -0,0 +1,2 @@
|
||||
MO_FALSE_IS_EMPTY=yeppers
|
||||
someFalseValue=false
|
||||
1
tests/false-is-empty-env.expected
Normal file
1
tests/false-is-empty-env.expected
Normal file
@@ -0,0 +1 @@
|
||||
Works
|
||||
4
tests/false-is-empty-env.template
Normal file
4
tests/false-is-empty-env.template
Normal file
@@ -0,0 +1,4 @@
|
||||
Works
|
||||
{{#someFalseValue}}
|
||||
Never shown!
|
||||
{{/someFalseValue}}
|
||||
@@ -6,3 +6,11 @@ environment variable. You can use {{#VARIABLE}}content{{/VARIABLE}} to
|
||||
conditionally display content or iterate over the values of an array.
|
||||
|
||||
Learn more about mustache templates at https://mustache.github.io/
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user