Skip to content

Commit

Permalink
Merge pull request #172 from lucassabreu/fix/171
Browse files Browse the repository at this point in the history
fix: dont hide description
  • Loading branch information
lucassabreu authored Apr 25, 2022
2 parents e044662 + a4c33e5 commit 2d9c4f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- enabling `show-task` config were hiding the description column for table report format.

## [v0.33.0] - 2022-04-21

### Added
Expand Down
18 changes: 10 additions & 8 deletions internal/output/timeEntry.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,16 @@ func TimeEntriesPrint(opts ...TimeEntryOutputOpt) func([]dto.TimeEntry, io.Write

return func(timeEntries []dto.TimeEntry, w io.Writer) error {
tw := tablewriter.NewWriter(w)
taskColumn := 6
projectColumn := 4
header := []string{"ID", "Start", "End", "Dur",
"Project", "Description", "Tags"}
if options.ShowTasks {
header = append(
header[:5],
header[5:]...,
header[:taskColumn],
header[taskColumn-1:]...,
)
header[5] = "Task"
header[taskColumn] = "Task"
}

tw.SetHeader(header)
Expand All @@ -188,9 +190,9 @@ func TimeEntriesPrint(opts ...TimeEntryOutputOpt) func([]dto.TimeEntry, io.Write
}

projectName := ""
colors[4] = []int{}
colors[projectColumn] = []int{}
if t.Project != nil {
colors[4] = colorToTermColor(t.Project.Color)
colors[projectColumn] = colorToTermColor(t.Project.Color)
projectName = t.Project.Name
}

Expand All @@ -205,10 +207,10 @@ func TimeEntriesPrint(opts ...TimeEntryOutputOpt) func([]dto.TimeEntry, io.Write
}

if options.ShowTasks {
line = append(line[:5], line[5:]...)
line[5] = ""
line = append(line[:taskColumn], line[taskColumn-1:]...)
line[taskColumn] = ""
if t.Task != nil {
line[5] = fmt.Sprintf("%s (%s)", t.Task.Name, t.Task.ID)
line[taskColumn] = fmt.Sprintf("%s (%s)", t.Task.Name, t.Task.ID)
}
}

Expand Down

0 comments on commit 2d9c4f7

Please sign in to comment.