Skip to content

Commit

Permalink
entries: list shows project & services as separate columns
Browse files Browse the repository at this point in the history
  • Loading branch information
phiros committed Apr 3, 2019
1 parent c753b96 commit 0a7b470
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@ var entriesListCommand = &cobra.Command{

func printEntries(entries []*mite.TimeEntry) {
t := tabby.New()
t.AddHeader("id", "notes", "date", "time", "project,service")
t.AddHeader("id", "notes", "date", "time", "project", "service")
for _, entry := range entries {
trimmedNotes := strings.Replace(entry.Note, "\r\n", ",", -1)
shortenedNotes := fmt.Sprintf("%.50s", trimmedNotes)
shortenedProjectService := fmt.Sprintf("%.50s", entry.ProjectName+","+entry.ServiceName)
t.AddLine(entry.Id, shortenedNotes, entry.Date, entry.Duration.String(), shortenedProjectService)
shortenedProject := fmt.Sprintf("%.25s", entry.ProjectName)
shortenedService := fmt.Sprintf("%.25s", entry.ServiceName)
t.AddLine(entry.Id, shortenedNotes, entry.Date, entry.Duration.String(), shortenedProject, shortenedService)
}
t.Print()
}
Expand Down

0 comments on commit 0a7b470

Please sign in to comment.