diff --git a/demo/sourcing b/demo/sourcing new file mode 100755 index 0000000..f9dd47f --- /dev/null +++ b/demo/sourcing @@ -0,0 +1,13 @@ +#!/bin/bash +# +# This sources a simple script with the env. variables needed for the template. + +cd "$(dirname "$0")" # Go to the script's directory + +cat <&2 + exit 1 + fi + ;; + + *) # Every arg that is not a flag or a option should be a file + files+=("$arg") + ;; + esac + done fi - moGetContent moContent "$@" + moGetContent moContent "${files[@]}" moParse "$moContent" "" true ) diff --git a/tests/source.expected b/tests/source.expected new file mode 100644 index 0000000..a3050ef --- /dev/null +++ b/tests/source.expected @@ -0,0 +1,5 @@ +value +* 1 +* 2 +* 3 +AAA BBB diff --git a/tests/source.sh b/tests/source.sh new file mode 100755 index 0000000..806ea73 --- /dev/null +++ b/tests/source.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +cd "${0%/*}" +cat </dev/null 2>&1 +[[ "$?" -ne 1 ]] && echo "mo accepted a non existent file" diff --git a/tests/source.vars b/tests/source.vars new file mode 100644 index 0000000..58b50d3 --- /dev/null +++ b/tests/source.vars @@ -0,0 +1,4 @@ +export VAR=value +export ARR=(1 2 3) +declare -A ASSOC_ARR +export ASSOC_ARR=([a]=AAA [b]=BBB) \ No newline at end of file