diff options
Diffstat (limited to 'lib/util.bash')
-rw-r--r-- | lib/util.bash | 51 |
1 files changed, 6 insertions, 45 deletions
diff --git a/lib/util.bash b/lib/util.bash index bae620b..c2429a1 100644 --- a/lib/util.bash +++ b/lib/util.bash @@ -10,8 +10,6 @@ . "$BASHTARD_LIBDIR/util/pkg.bash" # shellcheck source=lib/util/svc.bash . "$BASHTARD_LIBDIR/util/svc.bash" -# shellcheck source=lib/vendor/bpt.bash -. "$BASHTARD_LIBDIR/vendor/bpt.bash" # Change the working directory. In usage, this is the same as using cd, # however, it will make additional checks to ensure everything is going fine. @@ -144,44 +142,17 @@ file_hash_md5() { file_template() { local file - local system - - file="$1" ; shift - - ext="${file##*.}" - path="$(playbook_path "base")/share/$file" - system="bashtard/file_template" - - if [[ -z "$ext" || "$ext" == "$file" ]] - then - debug "$system" "Missing extension for template $file, assuming satpl" - ext="satpl" - fi + local sedfile - if [[ ! -f "$path" ]] - then - crit "$system" "No template found at $path" - return 1 - fi + file="$(playbook_path "base")/share/$1" ; shift + sedfile="$(tmpfile)" - if [[ "$(type -t "file_template_$ext")" != "function" ]] + if [[ ! -f $file ]] then - crit "$system" "Invalid extension for template $file ($ext)" - return 1 + crit "bashtard/template" "Tried to render template from $file, but it doesn't exist" + return fi - "file_template_$ext" "$path" "$@" -} - -file_template_satpl() -{ - local file - local sedfile - - file="$1" ; shift - - sedfile="$(tmpfile)" - for kv in "$@" do debug "bashtard/template" "Adding $kv to sedfile at $sedfile" @@ -207,16 +178,6 @@ file_template_satpl() sed -f "$sedfile" "$file" } -file_template_bpt() -{ - local file - - file="$1" ; shift - - eval "$* bpt.main ge \"$file\"" - printf "\n" -} - # Check if the first argument given appears in the list of all following # arguments. in_args() { |