Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions cli/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,31 +97,33 @@ func listRecordsCommand(t *core.Timetrace) *cobra.Command {

for i, record := range records {
end := defaultString
totalDuration := defaultString
if record.End != nil {
end = t.Formatter().TimeString(*record.End)
totalDuration = t.Formatter().FormatDuration(record.End.Sub(record.Start))
}

billable := defaultBool

if record.IsBillable {
billable = "yes"
}

rows[i] = make([]string, 7)
rows[i] = make([]string, 8)
rows[i][0] = strconv.Itoa(len(records) - i)
rows[i][1] = t.Formatter().RecordKey(record)
rows[i][2] = record.Project.Key
rows[i][3] = t.Formatter().TimeString(record.Start)
rows[i][4] = end
rows[i][5] = billable
rows[i][6] = t.Formatter().FormatTags(record.Tags)
rows[i][5] = totalDuration
rows[i][6] = billable
rows[i][7] = t.Formatter().FormatTags(record.Tags)
}

footer := make([]string, 7)
footer := make([]string, 8)
footer[len(footer)-2] = "Total: "
footer[len(footer)-1] = t.Formatter().FormatDuration(getTotalTrackedTime(records))

out.Table([]string{"#", "Key", "Project", "Start", "End", "Billable", "Tags"}, rows, footer)
out.Table([]string{"#", "Key", "Project", "Start", "End", "Total", "Billable", "Tags"}, rows, footer)
},
}

Expand Down