go(report,main): add flag -printreport
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-07-18 01:58:56 +02:00
parent 5eaeb9c692
commit 948a95fb7e
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
2 changed files with 16 additions and 10 deletions

@ -4,6 +4,7 @@
package main
import (
"flag"
"log"
"sync"
@ -16,6 +17,9 @@ var version = "development"
func main() {
log.Println("starting math-optim version", "'"+version+"'")
doPrint := flag.Bool("printreport", true, "print report.tex to console")
flag.Parse()
// atm we're only doing Random search and SHC
algoCount := 2
@ -32,7 +36,7 @@ func main() {
report.SaveTexAllPics()
report.SaveTexAllTables()
report.SaveAndPrint()
report.SaveAndPrint(*doPrint)
log.Println("looks like we're done")
log.Println("run an equivalent of `pdflatex -clean -shell-escape -interaction=nonstopmode ./report.tex` to get a pdf")

@ -80,7 +80,7 @@ func saveMetaSty() error {
// SaveAndPrint emits the tex files necessary to compile the report in full
// (report.tex, meta.sty) and prints the report.tex file to console.
func SaveAndPrint() {
func SaveAndPrint(doPrint bool) {
fname := "report.tex"
err := emitReportTex(fname)
@ -93,6 +93,7 @@ func SaveAndPrint() {
log.Fatal(err)
}
if doPrint {
fmt.Fprint(os.Stderr, "\n* printing the report...\n\n")
fh, err := os.Open(fname)
@ -104,4 +105,5 @@ func SaveAndPrint() {
if err != nil {
log.Fatal(err)
}
}
}