time in list

This commit is contained in:
Erik Winter 2025-01-06 11:23:24 +01:00
parent b5715504be
commit c8ebf6df33
2 changed files with 10 additions and 1 deletions

BIN
dist/plan vendored

Binary file not shown.

View File

@ -159,7 +159,7 @@ func (lr ListResult) Render() string {
return lr.Tasks[i].LocalID < lr.Tasks[j].LocalID return lr.Tasks[i].LocalID < lr.Tasks[j].LocalID
}) })
var showRec, showDur bool var showRec, showTime, showDur bool
for _, tl := range lr.Tasks { for _, tl := range lr.Tasks {
if tl.Task.Recurrer != nil { if tl.Task.Recurrer != nil {
showRec = true showRec = true
@ -167,6 +167,9 @@ func (lr ListResult) Render() string {
if tl.Task.Duration > time.Duration(0) { if tl.Task.Duration > time.Duration(0) {
showDur = true showDur = true
} }
if !tl.Task.Time.IsZero() {
showTime = true
}
} }
title := []string{"id"} title := []string{"id"}
@ -174,6 +177,9 @@ func (lr ListResult) Render() string {
title = append(title, "rec") title = append(title, "rec")
} }
title = append(title, "project", "date") title = append(title, "project", "date")
if showTime {
title = append(title, "time")
}
if showDur { if showDur {
title = append(title, "dur") title = append(title, "dur")
} }
@ -190,6 +196,9 @@ func (lr ListResult) Render() string {
row = append(row, recStr) row = append(row, recStr)
} }
row = append(row, tl.Task.Project, tl.Task.Date.String()) row = append(row, tl.Task.Project, tl.Task.Date.String())
if showTime {
row = append(row, tl.Task.Time.String())
}
if showDur { if showDur {
durStr := "" durStr := ""
if tl.Task.Duration > time.Duration(0) { if tl.Task.Duration > time.Duration(0) {