Files
inp2025/cmds/game.go
2025-11-10 14:52:16 +08:00

33 lines
542 B
Go

package cmds
import (
"inp2025/workflows"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.uber.org/zap"
)
var gameCmd = &cobra.Command{
Use: "game",
Run: func(cmd *cobra.Command, args []string) {
router := workflows.GameServer()
err := router.Listen(":" + viper.GetString("port"))
if err != nil {
panic(err)
}
zap.L().Info("server up",
zap.String("addr", router.ListenAddr()))
if err := router.WaitFor(); err != nil {
panic(err)
}
},
}
func init() {
gameCmd.Flags().
String("port", "12345", "")
}