Several changes

Switch timerlist to a slice of pointers to timers
Go mod
This commit is contained in:
2022-01-17 09:55:44 -06:00
parent d35b67037e
commit d0c9ea8f27
4 changed files with 36 additions and 14 deletions

View File

@@ -88,7 +88,9 @@ func NewTimer() *Timer {
// ParseTimer parses the input text string into a Timer struct
func ParseTimer(text string) (*Timer, error) {
var err error
timer := Timer{}
timer := Timer{
AdditionalTags: make(map[string]string),
}
timer.Original = strings.Trim(text, "\t\n\r ")
originalParts := strings.Fields(timer.Original)
@@ -209,3 +211,12 @@ func (timer *Timer) HasProject(project string) bool {
}
return false
}
func (timer *Timer) HasTag(name string) bool {
_, ok := timer.AdditionalTags[name]
return ok
}
func (timer *Timer) GetTag(name string) string {
return timer.AdditionalTags[name]
}