package sqlgen import ( "fmt" "os" ) func Main() { usage := func() { fmt.Fprintf(os.Stderr, ` %s DRIVER DEFS_PATH OUTPUT_PATH Drivers are one of: sqlite, postgres `, os.Args[0]) os.Exit(1) } if len(os.Args) != 4 { usage() } var ( template string driver = os.Args[1] defsPath = os.Args[2] outputPath = os.Args[3] ) switch driver { case "sqlite": template = sqliteTemplate default: fmt.Fprintf(os.Stderr, "Unknown driver: %s", driver) usage() } err := render(template, defsPath, outputPath) if err != nil { fmt.Fprintf(os.Stderr, "Error: %v", err) os.Exit(1) } }