Move days/classes to args
This commit is contained in:
parent
787d2bc904
commit
da96480549
17
generate.go
17
generate.go
|
@ -7,16 +7,19 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
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)")
|
||||||
pages = flag.Int("pages", 7, "number of pages")
|
courseDays = flag.String("courseDays", "Monday,Wednesday,Other", "days for the class template")
|
||||||
debug = flag.Bool("debug", false, "leave LaTeX log files")
|
courses = flag.String("courses", "Cxxx,Cyyy,Czzz", "courses for the class template")
|
||||||
|
pages = flag.Int("pages", 7, "number of pages")
|
||||||
|
debug = flag.Bool("debug", false, "leave LaTeX log files")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -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),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue