Implementing a search path

Closes #30
This commit is contained in:
Tyler Akins
2019-07-19 21:10:42 -05:00
parent 9f6d3bcdab
commit 7a8d1d260e
16 changed files with 255 additions and 130 deletions

View File

@@ -1 +1 @@
cat: --help: No such file or directory
File does not exist: /home/fidian/repo/mo/tests/--help

View File

@@ -2,4 +2,4 @@
# This should display a message indicating that the file --help
# could not be found. It should not display a help messsage.
cd "${0%/*}"
../mo -- --help 2>&1
../mo -u -- --help 2>&1

View File

@@ -9,9 +9,19 @@ Learn more about mustache templates at https://mustache.github.io/
Simple usage:
mo [--false] [--help] [--source=FILE] filenames...
mo [OPTIONS] filenames...
--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.
Options:
-u, --fail-not-set
- Fail upon expansion of an unset variable.
-e, --false
- Treat the string "false" as empty for conditionals.
-h, --help
- This message.
-s=FILE, --source=FILE
- Load FILE into the environment before processing templates.
-p=PATH, --path=PATH
- Set a colon-delimited list of folders to search for templates.
MO_VERSION=2.0.4

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
cd "${0%/*}"
../mo --help
../mo -u --help

View File

@@ -1 +0,0 @@
cat: --something: No such file or directory

View File

@@ -1 +1 @@
cat: partial-missing.partial: No such file or directory
File does not exist: /home/fidian/repo/mo/tests/partial-missing.partial

View File

@@ -1,8 +1,9 @@
#!/usr/bin/env bash
cd "${0%/*}"
../mo partial-missing.template 2>&1
../mo -u partial-missing.template 2>&1
returned=$?
if [[ $? -ne 1 ]]; then
echo "Did not return 1"
if [[ $returned -ne 1 ]]; then
echo "Did not return 1. Instead, returned $returned."
fi

View File

@@ -1,7 +1,8 @@
#!/usr/bin/env bash
cd "${0%/*}"
cat <<EOF | ../mo --source=source.vars
. ../mo
cat <<EOF | mo --source=source.vars
{{VAR}}
{{#ARR}}
* {{.}}

View File

@@ -1,4 +1,4 @@
export VAR=value
export ARR=(1 2 3)
declare -A ASSOC_ARR
export ASSOC_ARR=([a]=AAA [b]=BBB)
ASSOC_ARR=([a]=AAA [b]=BBB)