aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-06-03 11:24:55 +0200
committerTeddy Wing2017-06-03 11:28:25 +0200
commitd998a82d4019b1fc5a15734f091852b1b0f086d4 (patch)
tree67959784f74f803e9c9528d246815e320f4d238c
parente99c7b69e0981d4a7b87310cd811b90a2ffbe12f (diff)
downloadtimetasker-d998a82d4019b1fc5a15734f091852b1b0f086d4.tar.bz2
Create a new Project type
This corresponds to a "project" entry in the new config2.toml file. (See 13c84cd9973458750305c72a919cf921d9b22b04). Instead of decoding generic `interface{}`s as projects from the TOML, make them a real type. The reason why we're using `int`s where we used to use strings is that the new TOML format will have users write IDs directly in the config file, instead of having the program automatically search for those IDs and use them as we had previously designed. Maybe we'll bring that functionality back at some point, but for now it's too bothersome to implement and I don't consider it worth the trouble.
-rw-r--r--main.go4
-rw-r--r--timetask/fields.go10
2 files changed, 12 insertions, 2 deletions
diff --git a/main.go b/main.go
index b31a4f0..ccdcaed 100644
--- a/main.go
+++ b/main.go
@@ -6,7 +6,7 @@ import (
"log"
// "os"
- // "github.com/teddywing/timetasker/timetask"
+ "github.com/teddywing/timetasker/timetask"
"github.com/BurntSushi/toml"
)
@@ -16,7 +16,7 @@ type Config struct {
Username string
PasswordCmd string
}
- Projects map[string]interface{}
+ Projects map[string]timetask.Project
}
var config Config
diff --git a/timetask/fields.go b/timetask/fields.go
index f3bb27d..da2b37d 100644
--- a/timetask/fields.go
+++ b/timetask/fields.go
@@ -16,6 +16,16 @@ package timetask
// WorkTypes []WorkType `yaml:"work_types"`
// }
+type Project struct {
+ Client int
+ Project int
+ Module int
+ Task int
+ WorkType int
+ Time int
+ Billable bool
+}
+
// type Module struct {
// ID int
// Name string