Browse Source

allow a directory as the argument

master
parent
commit
baa18137c5
  1. 23
      gomplate/gomplate-generate.sh

23
gomplate/gomplate-generate.sh

@ -30,11 +30,20 @@
template_path="$1"
template_name="$2"
exec @l_prefix@/bin/gomplate \
-d params=stdin:?type=application/yaml \
-t $template_file \
-i "{{ template \"$template_name:template\" \
(coll.Merge \
(ds \"params\") \
(tmpl.Exec \"$template_name:params\" | yaml)) }}"
cmd="@l_prefix@/bin/gomplate"
cmd="$cmd -d params=stdin:?type=application/yaml"
cmd="$cmd -i \"{{ template \\\"$template_name:template\\\""
cmd="$cmd (coll.Merge (ds \\\"params\\\") (tmpl.Exec \\\"$template_name:params\\\" | yaml)) }}\""
if [ -f $template_path ]; then
cmd="$cmd -t $template_path"
elif [ -d $template_path ]; then
for template_file in $template_path/*; do
if [ -f $template_file ]; then
cmd="$cmd -t $template_file"
fi
done
fi
eval "$cmd"

Loading…
Cancel
Save