gcd_downloader/cmd.go

27 lines
471 B
Go

//go:build !gokrazy
package main
import (
"flag"
"log"
"os"
)
func main() {
flag.Parse()
if os.Getenv("GCD_USERNAME") == "" || os.Getenv("GCD_PASSWORD") == "" {
log.Println("Username and password not provided")
os.Exit(0)
}
createDirs()
lastUpdate := getLatestDate()
if shouldUpdate(lastUpdate) {
download(lastUpdate)
log.Println("update complete, waiting 1h to check again")
} else {
log.Println("It's too early, waiting 1h to check again")
}
}