aboutsummaryrefslogtreecommitdiff
path: root/lib/util.bash
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2023-05-15 08:18:12 +0200
committerPatrick Spek <p.spek@tyil.nl>2023-05-15 08:20:07 +0200
commita90e94c845cded2aeda7b70ea3ec5d6b6085f44a (patch)
tree62ae27de9a8502cce1ace16ee9e6fce281f67136 /lib/util.bash
parent0b1146b6aef61a4369922b67a29e42c992f5de6b (diff)
Remove bpt from the codebase again
The power of the templating tool were not as big as I had hoped. The inclusion of another license also doesn't really seem like it is worth the trouble considering the tool didn't really get me the high level of templating I had desired. The quest for templating continues...
Diffstat (limited to 'lib/util.bash')
-rw-r--r--lib/util.bash51
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() {