aboutsummaryrefslogtreecommitdiffstats
path: root/timetask/generator.go
diff options
context:
space:
mode:
authorTeddy Wing2017-06-03 15:26:16 +0200
committerTeddy Wing2017-06-03 15:26:16 +0200
commitb9c75fc559a5d79042e419cba8a9b5a4546c9b6d (patch)
tree17ee42774516b8e9ffb159b72213f772783d4b6d /timetask/generator.go
parent194f180cbc2cdf8f739b83296e26ea8805d2c122 (diff)
downloadtimetasker-b9c75fc559a5d79042e419cba8a9b5a4546c9b6d.tar.bz2
Remove generator.go, templates/ directory
These are not needed in the new world where we only submit a single time entry at a time and entry parameters are filled in on the command line. My guess is we'll likely have some sort of generator in the future to create the initial `config.toml` file, but that won't contain any logic-based data. My guess is we'll probably be able to just stick it in a template string right inside a *.go file.
Diffstat (limited to 'timetask/generator.go')
-rw-r--r--timetask/generator.go44
1 files changed, 0 insertions, 44 deletions
diff --git a/timetask/generator.go b/timetask/generator.go
deleted file mode 100644
index 5d0fa7f..0000000
--- a/timetask/generator.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package timetask
-
-import (
- "io"
- "log"
- "text/template"
- "time"
-
- "github.com/olebedev/when"
- "github.com/olebedev/when/rules/common"
- "github.com/olebedev/when/rules/en"
-)
-
-func GenerateWeeklyTimesheet(wr io.Writer, defaults TimeEntry) {
- w := when.New(nil)
- w.Add(en.All...)
- w.Add(common.All...)
-
- monday, err := w.Parse("last monday", time.Now())
- if err != nil {
- log.Panic(err)
- }
-
- time_entries := []TimeEntry{}
- day := monday.Time
- for i := 1; i <= 5; i++ {
- time_entries = append(time_entries, defaults)
- time_entries[len(time_entries) - 1].Date = day
- day = day.AddDate(0, 0, 1) // Add 1 day
- }
-
- t, err := template.ParseFiles(
- "templates/weekly_timesheet.yml.tmpl",
- "templates/timesheet.yml.tmpl",
- )
- if err != nil {
- log.Panic(err)
- }
-
- err = t.Execute(wr, time_entries)
- if err != nil {
- log.Panic(err)
- }
-}