Add time page

This commit is contained in:
Martin
2026-02-01 21:30:19 +01:00
committed by Martin Pander
parent effd95f6c1
commit 681ed7e635
12 changed files with 915 additions and 115 deletions

17
main.go
View File

@ -10,6 +10,7 @@ import (
"tasksquire/common"
"tasksquire/pages"
"tasksquire/taskwarrior"
"tasksquire/timewarrior"
tea "github.com/charmbracelet/bubbletea"
)
@ -26,9 +27,23 @@ func main() {
log.Fatal("Unable to find taskrc file")
}
var timewConfigPath string
if timewConfigEnv := os.Getenv("TIMEWARRIORDB"); timewConfigEnv != "" {
timewConfigPath = timewConfigEnv
} else if _, err := os.Stat(os.Getenv("HOME") + "/.timewarrior/timewarrior.cfg"); err == nil {
timewConfigPath = os.Getenv("HOME") + "/.timewarrior/timewarrior.cfg"
} else {
// Default to empty string if not found, let TimeSquire handle defaults or errors if necessary
// But TimeSquire seems to only take config location.
// Let's assume standard location if not found or pass empty if it auto-detects.
// Checking TimeSquire implementation: it calls `timew show` which usually works if timew is in path.
timewConfigPath = ""
}
ts := taskwarrior.NewTaskSquire(taskrcPath)
tws := timewarrior.NewTimeSquire(timewConfigPath)
ctx := context.Background()
common := common.NewCommon(ctx, ts)
common := common.NewCommon(ctx, ts, tws)
file, err := os.OpenFile("app.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {