2022-06-15 23:36:47 +02:00
|
|
|
// Copyright 2022 wanderer <a_mirre at utb dot cz>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
package report
|
|
|
|
|
|
|
|
//go:generate go run gen.go
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
2022-07-12 16:56:49 +02:00
|
|
|
const (
|
|
|
|
outPrefix = "out/"
|
2022-07-12 21:15:38 +02:00
|
|
|
texDir = "tex/"
|
2022-07-12 16:56:49 +02:00
|
|
|
picsDir = "pics/"
|
|
|
|
)
|
|
|
|
|
2022-07-12 21:15:38 +02:00
|
|
|
// GetPicsDirPrefix returns the path to the folder meant for tex files.
|
|
|
|
func GetTexDir() string {
|
|
|
|
return outPrefix + texDir
|
|
|
|
}
|
|
|
|
|
2022-07-12 16:56:49 +02:00
|
|
|
// GetPicsDirPrefix returns the path to the folder meant for plot pics.
|
|
|
|
func GetPicsDir() string {
|
|
|
|
return outPrefix + picsDir
|
|
|
|
}
|
|
|
|
|
2022-06-15 23:36:47 +02:00
|
|
|
// Print prints stats in a report format.
|
|
|
|
func Print() {
|
2022-06-17 21:37:01 +02:00
|
|
|
fmt.Fprint(os.Stderr, "\n* printing the report...\n\n")
|
2022-06-15 23:36:47 +02:00
|
|
|
|
2022-06-17 20:45:16 +02:00
|
|
|
// when run from the repo root
|
2022-07-12 21:15:38 +02:00
|
|
|
fname := GetTexDir() + "report.tex"
|
2022-06-15 23:36:47 +02:00
|
|
|
|
|
|
|
fh, err := os.Open(fname)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
_, err = io.Copy(os.Stdout, fh)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|