Move days/classes to args

This commit is contained in:
Chris Sexton 2019-08-09 20:15:00 -04:00
parent 787d2bc904
commit da96480549
1 changed files with 10 additions and 7 deletions

View File

@ -7,6 +7,7 @@ import (
"log" "log"
"os" "os"
"os/exec" "os/exec"
"strings"
"text/template" "text/template"
"time" "time"
) )
@ -15,6 +16,8 @@ var (
fileName = flag.String("file", "output", "Name of output file") fileName = flag.String("file", "output", "Name of output file")
tplPath = flag.String("tpl", "daily", "Path to templates") tplPath = flag.String("tpl", "daily", "Path to templates")
startDate = flag.String("start", "", "date of start (yyy-mm-dd)") startDate = flag.String("start", "", "date of start (yyy-mm-dd)")
courseDays = flag.String("courseDays", "Monday,Wednesday,Other", "days for the class template")
courses = flag.String("courses", "Cxxx,Cyyy,Czzz", "courses for the class template")
pages = flag.Int("pages", 7, "number of pages") pages = flag.Int("pages", 7, "number of pages")
debug = flag.Bool("debug", false, "leave LaTeX log files") debug = flag.Bool("debug", false, "leave LaTeX log files")
) )
@ -65,8 +68,8 @@ func class(file *os.File) {
check(head.Execute(file, nil)) check(head.Execute(file, nil))
for i := 0; i < *pages; i++ { for i := 0; i < *pages; i++ {
info := map[string]interface{}{ info := map[string]interface{}{
"Courses": []string{"C311", "C346", "C490"}, "Courses": strings.Split(*courses, ","),
"Days": []string{"Monday", "Wednesday", "Other"}, "Days": strings.Split(*courseDays, ","),
"DateRange": fmt.Sprintf("%s-%s", day.Format("2006/01/02"), day.Add(24*time.Hour).Format("02")), "DateRange": fmt.Sprintf("%s-%s", day.Format("2006/01/02"), day.Add(24*time.Hour).Format("02")),
"Week": fmt.Sprintf("Week %d", i+1), "Week": fmt.Sprintf("Week %d", i+1),
} }