Browse Source

download commands modified

master
Juni Kim 2 years ago
parent
commit
bc433d8630
  1. 4
      main.go
  2. 1
      server.go

4
main.go

@ -15,11 +15,11 @@ var template []byte
func main() { func main() {
root := &cobra.Command{}; root := &cobra.Command{};
servecmd := &cobra.Command{ servecmd := &cobra.Command{
Use: "serve",
Use: "download",
Short: "server to listen for competitive companion requests", Short: "server to listen for competitive companion requests",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
port, _ := cmd.Flags().GetInt("port"); port, _ := cmd.Flags().GetInt("port");
fmt.Println("Listning on port", port, "...")
fmt.Println("Listening on port", port, "...")
server(port); server(port);
}, },
} }

1
server.go

@ -32,6 +32,7 @@ func server(port int) {
os.WriteFile(path.Join("cpgo_tests", fmt.Sprint(idx+1) + ".input"), input, 0644); os.WriteFile(path.Join("cpgo_tests", fmt.Sprint(idx+1) + ".input"), input, 0644);
os.WriteFile(path.Join("cpgo_tests", fmt.Sprint(idx+1) + ".output"), output, 0644); os.WriteFile(path.Join("cpgo_tests", fmt.Sprint(idx+1) + ".output"), output, 0644);
} }
os.Exit(0);
}) })
http.ListenAndServe(fmt.Sprintf("127.0.0.1:%v", port), nil); http.ListenAndServe(fmt.Sprintf("127.0.0.1:%v", port), nil);
} }
Loading…
Cancel
Save