Implemented GetOutput

This commit is contained in:
マリウス 2020-10-15 22:44:12 +01:00
parent 526fd502be
commit 1f2c1d52aa
No known key found for this signature in database
GPG key ID: C228EF0A530AF06F

View file

@ -143,3 +143,10 @@ func (entry *Entry) GetOutputForFinish() (string) {
return fmt.Sprintf("%s finished tracking task%s\n", CharFinish, outputSuffix)
}
func (entry *Entry) GetOutput() (string) {
trackDiff := entry.Finish.Sub(entry.Begin)
trackDiffOut := time.Time{}.Add(trackDiff)
return fmt.Sprintf("%s %s on %s from %s to %s (%sh)", color.FgGray.Render(entry.ID), color.FgLightWhite.Render(entry.Task), color.FgLightWhite.Render(entry.Project), color.FgLightWhite.Render(entry.Begin.Format("2006-01-02 15:04 -0700")), color.FgLightWhite.Render(entry.Finish.Format("2006-01-02 15:04 -0700")), color.FgLightWhite.Render(trackDiffOut.Format("15:04")))
}