-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
meta.sh
executable file
·36 lines (34 loc) · 1.23 KB
/
meta.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
echo "const std = @import(\"std\");"
echo
echo "const PptxEmbed = struct { filename : [] const u8, content : [] const u8 };"
echo "pub const toCopy = std.ArrayList(*PptxEmbed);"
echo
for i in $(find pptx_template/const -type f) ; do
fn=cpy_$(basename $i)
varname=const_$(echo $fn | sed s/\\./_/g)
destname=$(echo $i | sed 's/pptx_template\/const\///')
echo "const $varname = PptxEmbed { .filename = \"$destname\", .content = @embedFile(\"../$i\")};"
done
echo
echo "pub fn initToCopy() !*std.ArrayList(*PptxEmbed) {"
for i in $(find assets/pptx -type f) ; do
fn=cpy_$(basename $i)
varname=const_$(echo $fn | sed s/\\./_/g)
echo " try toCopy.append(&$varname);"
done
echo " return toCopy;"
echo "}"
echo
echo
for i in $(find pptx_template/variable -type f) ; do
fn=cpy_$(basename $i)
varname=mod_$(echo $fn | sed s/\\./_/g | sed s/\\[// | sed s/\\]//)
destname=$(echo $i | sed 's/pptx_template\/variable\///')
echo "const $varname = PptxEmbed { .filename = \"$destname\", .content = @embedFile(\"../$i\")};"
done
# for i in $(find pptx_template -type f) ; do
# fn=cpy_$(basename $i)
# varname=mod_$(echo $fn | sed s/\\./_/g)
# echo "toModify.append($varname);"
# done