2024-06-17 08:06:32 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"sync"
|
2024-06-19 19:27:13 +00:00
|
|
|
"time"
|
|
|
|
)
|
2024-06-17 08:06:32 +00:00
|
|
|
|
|
|
|
var waitGroup sync.WaitGroup
|
|
|
|
|
2024-06-19 19:27:13 +00:00
|
|
|
func errHandler(err error, message string) {
|
|
|
|
if err != nil {
|
|
|
|
fmt.Printf("\n\n%s: %s\n", message, err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-17 08:06:32 +00:00
|
|
|
func main() {
|
|
|
|
options, err := ParseOptions()
|
|
|
|
errHandler(err, "Error parsing options")
|
|
|
|
|
2024-06-19 19:27:13 +00:00
|
|
|
options.InitDAVclients()
|
2024-06-17 08:06:32 +00:00
|
|
|
|
2024-06-19 19:27:13 +00:00
|
|
|
calendars, err := GetCalendars()
|
|
|
|
errHandler(err, "Error getting calendars")
|
2024-06-17 08:06:32 +00:00
|
|
|
|
2024-06-19 19:27:13 +00:00
|
|
|
for _,calendar := range calendars {
|
|
|
|
fmt.Println(calendar.Name, "-", calendar.Path)
|
2024-06-17 08:06:32 +00:00
|
|
|
}
|
|
|
|
|
2024-06-19 19:27:13 +00:00
|
|
|
|
|
|
|
calendarObjects, err := GetTODOs(calendars[1].Path)
|
|
|
|
errHandler(err, "Error getting TODOs")
|
2024-06-17 08:06:32 +00:00
|
|
|
|
2024-06-19 19:27:13 +00:00
|
|
|
today := time.Now()
|
|
|
|
todos,err := ParseDueDateTODOs(calendarObjects ,today)
|
|
|
|
|
|
|
|
fmt.Println(todos)
|
|
|
|
|
|
|
|
fmt.Println("In total we have",len(calendarObjects), "todos")
|
2024-06-17 08:06:32 +00:00
|
|
|
}
|
2024-06-19 19:27:13 +00:00
|
|
|
|
|
|
|
|