Show if active in `time` command

This commit is contained in:
Brian Buller 2020-06-01 12:19:54 -05:00
parent ba0e465723
commit fd0b0cfb56
1 changed files with 7 additions and 1 deletions

View File

@ -131,16 +131,22 @@ func (a *AppState) opShowTime(args []string) int {
}
list = list.Filter(doFilters)
var isActive bool
var total time.Duration
for _, v := range *list {
dur := v.FinishDate.Sub(v.StartDate)
if v.FinishDate.IsZero() {
dur = time.Now().Sub(v.StartDate)
isActive = true
}
total += dur
}
total = total.Round(GetRoundToDuration())
fmt.Printf("%.2f\n", DurationToDecimal(total))
if isActive {
fmt.Printf("%.2f+\n", DurationToDecimal(total))
} else {
fmt.Printf("%.2f\n", DurationToDecimal(total))
}
return 0
}