-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild
More file actions
executable file
·27 lines (26 loc) · 1.16 KB
/
Copy pathbuild
File metadata and controls
executable file
·27 lines (26 loc) · 1.16 KB
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
#!/usr/bin/env nu
def main [
toBuild: string = "@all"
flavor: string = "mocha"
] {
mkdir out
if $toBuild == "@all" {
print "Manifest name is set to @all, compiling all manifests"
let manifests = ls -l manifests/*.yaml | where type == file | get name | each {|x| $x | parse 'manifests/{name}.yaml' | get name | $in.0 }
for manifest in $manifests {
print $"Compiling ($manifest)..."
typst c main.typ $"out/($manifest){p}.png" --input flavor=$"($flavor)" --input manifest=$"($manifest)" --ppi 72
mv $"out/($manifest)1.png" $"out/($manifest)-vertical.png"
mv $"out/($manifest)2.png" $"out/($manifest)-horizontal.png"
}
} else {
mut manifest = $toBuild
while (ls -l $"manifests/($manifest).yaml" | $in.target.0 != null) {
$manifest = ls -l $"manifests/($manifest).yaml" | $in.target.0 | parse '{name}.yaml' | get name | $in.0
}
print $"Compiling ($manifest)..."
typst c main.typ $"out/($manifest){p}.png" --input flavor=$"($flavor)" --input manifest=$"($manifest)" --ppi 72
mv $"out/($manifest)1.png" $"out/($manifest)-vertical.png"
mv $"out/($manifest)2.png" $"out/($manifest)-horizontal.png"
}
}