alias w := watch
alias c := compile

alias nw := nix-watch
alias nb := nix-build
alias ns := nix-shell

file := "main.typ"
out := `cat doc.toml | tomlq '.doctype + (.worknumber | tostring) + "_" + (.authors[0].name | split(" ")[0]) + "_" + (.authors[0].edu + "-" + .authors[0].group) + "_" + .subject + ".pdf"'`

[group('typst')]
watch:
    typst w {{file}} {{out}}
[group('typst')]
compile:
    typst c {{file}} {{out}}

copy-done:
    cp main.pdf ../{{out}}

[group('nix')]
nix-shell:
    nix shell nixpkgs#{yq,typst}
[group('nix')]
nix-watch:
    nix run .#watch
[group('nix')]
nix-build:
    nix run .#build
