30 lines
648 B
Go
30 lines
648 B
Go
package cli
|
|
|
|
import (
|
|
"log"
|
|
|
|
"ronnyfriedland/timetracker/v2/internal/excel"
|
|
"ronnyfriedland/timetracker/v2/internal/logic"
|
|
)
|
|
|
|
const dateLayout = "02.01.2006"
|
|
const timeLayout = "15:04:05"
|
|
|
|
func Run(configPath *string, archiveData *bool) {
|
|
duration := logic.Execute(configPath)
|
|
|
|
if duration.Complete {
|
|
log.Printf("[%s] - Work duration: %2.2fh",
|
|
duration.Date.Format(dateLayout),
|
|
duration.Duration.Hours())
|
|
|
|
log.Printf("[%s] - Start: %s, End: %s",
|
|
duration.Date.Format(dateLayout),
|
|
duration.StartTime.Format(timeLayout),
|
|
duration.EndTime.Format(timeLayout))
|
|
|
|
if *archiveData {
|
|
excel.Export(configPath, duration)
|
|
}
|
|
}
|
|
}
|