This repository has been archived on 2026-09-16. You can view files and clone it, but cannot push or open issues or pull requests.
typst_reporter/diagnostics.typ

49 lines
1.3 KiB
Plaintext

#import "diagnostics-model.typ": diagnostics-model
#import "diagnostics-normalize.typ": normalize
#let diagnostics-file = sys.inputs.at("diagnostics", default: none)
#let author = sys.inputs.at("author", default: none)
#if diagnostics-file == none {
panic(
"Missing diagnostics input.\n" +
"Usage: typst compile --input diagnostics=diagnostics/file.txt " +
"--input author=\"Your name\" diagnostics.typ output.pdf"
)
}
#if author == none or str.trim(str(author)) == "" {
panic(
"Missing required diagnostics author.\n" +
"Add: --input author=\"Your name\""
)
}
#let source = read(diagnostics-file, encoding: "utf8")
#let rules = yaml("diagnostics-rules.yaml")
#let data = normalize(source, rules: rules, source-name: diagnostics-file)
#if data.at("generated", default: "Unknown") == "Unknown" {
panic(
"Missing required diagnostics date.\n" +
"The WinDiagnostics dump must contain a Generated: date in its header."
)
}
#let themes = yaml("themes.yaml")
#let theme-name = lower(str(sys.inputs.at("theme", default: "default")))
#if theme-name not in themes {
panic(
"Unknown diagnostics theme: \"" + theme-name + "\".\n" +
"Choose one of: " + themes.keys().join(", ")
)
}
#show: diagnostics-model.with(
data: data,
author: author,
theme: themes.at(theme-name),
logo: "assets/beffroi.png",
)