diff --git a/z/entry.go b/z/entry.go index 942bb65..9911493 100644 --- a/z/entry.go +++ b/z/entry.go @@ -147,11 +147,18 @@ func (entry *Entry) GetOutputForFinish() (string) { return fmt.Sprintf("%s finished tracking task%s\n", CharFinish, outputSuffix) } -func (entry *Entry) GetOutput() (string) { +func (entry *Entry) GetOutput(full bool) (string) { + var output 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"))) + if full == false { + output = 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"))) + } else { + output = fmt.Sprintf("%s\n %s on %s\n %sh from %s to %s\n\n Notes:\n %s\n", color.FgGray.Render(entry.ID), color.FgLightWhite.Render(entry.Task), color.FgLightWhite.Render(entry.Project), color.FgLightWhite.Render(trackDiffOut.Format("15:04")), 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(strings.Replace(entry.Notes, "\n", "\n ", -1)) ) + } + + return output } func GetFilteredEntries(entries []Entry, project string, task string, since time.Time, until time.Time) ([]Entry, error) { diff --git a/z/listCmd.go b/z/listCmd.go index fdd852a..f82c856 100644 --- a/z/listCmd.go +++ b/z/listCmd.go @@ -54,7 +54,7 @@ var listCmd = &cobra.Command{ duration := entry.Finish.Sub(entry.Begin) durationDec := decimal.NewFromFloat(duration.Hours()) totalHours = totalHours.Add(durationDec) - fmt.Printf("%s\n", entry.GetOutput()) + fmt.Printf("%s\n", entry.GetOutput(false)) } if listTotalTime == true {