Add time page
This commit is contained in:
17
main.go
17
main.go
@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user