go(report,main): add flag -printreport
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
5eaeb9c692
commit
948a95fb7e
6
main.go
6
main.go
@ -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,15 +93,17 @@ func SaveAndPrint() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
fmt.Fprint(os.Stderr, "\n* printing the report...\n\n")
|
||||
if doPrint {
|
||||
fmt.Fprint(os.Stderr, "\n* printing the report...\n\n")
|
||||
|
||||
fh, err := os.Open(fname)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fh, err := os.Open(fname)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
_, err = io.Copy(os.Stdout, fh)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
_, err = io.Copy(os.Stdout, fh)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user