func main()

in cmd/ops_agent_windows/main_windows.go [40:75]


func main() {

	infoLog := logs.NewSimpleLogger()

	if ok, err := svc.IsWindowsService(); ok && err == nil {
		if err := run(serviceName); err != nil {
			log.Fatal(err)
		}
	} else if err != nil {
		log.Fatalf("failed to talk to service control manager: %v", err)
	} else {
		flag.Parse()
		if *installServices && *uninstallServices {
			log.Fatal("Can't use both --install and --uninstall")
		}
		if *installServices {
			if err := install(); err != nil {
				log.Fatal(err)
			}
			infoLog.Printf("installed services")
		} else if *uninstallServices {
			if err := uninstall(); err != nil {
				log.Fatal(err)
			}
			infoLog.Printf("uninstalled services")
		} else if *healthChecks {
			healthCheckResults := getHealthCheckResults()
			healthchecks.LogHealthCheckResults(healthCheckResults, infoLog)
			infoLog.Println("Health checks finished")
		} else {
			// TODO: add an interactive GUI box with the Install, Uninstall, and Cancel buttons.
			fmt.Println("Invoked as a standalone program with no flags. Nothing to do.")
			fmt.Println("Use either --healthchecks, --install, --uninstall to take action.")
		}
	}
}