basic development runner

This commit is contained in:
2024-09-24 16:43:32 -05:00
parent e94f4b0f8c
commit 446f178bfd

View File

@@ -0,0 +1,42 @@
package develop
import (
"fmt"
"internal/api"
"os"
"github.com/joho/godotenv"
)
var (
client *api.SyncClient
)
func init() {
// Load .env file if available
err := godotenv.Load()
if err != nil {
fmt.Println(".env file not loaded")
}
}
func main() {
// Load timezone
// tzLocation, err := time.LoadLocation("America/Chicago")
// if err != nil {
// fmt.Println("Error loading location:", err)
// os.Exit(1)
// }
client = api.NewSyncClient(os.Getenv("TODOIST_API_KEY"))
client.sync(true)
for {
_, changes, err := client.sync(false)
if err != nil {
fmt.Println("Error syncing:", err)
os.Exit(1)
}
}
}