Files
inp2025/player.go

38 lines
809 B
Go

package main
import (
"gitea.konchin.com/ytshih/inp2025/stages"
tea "github.com/charmbracelet/bubbletea"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var playerCmd = &cobra.Command{
Use: "player",
Run: func(cmd *cobra.Command, args []string) {
queue := []*tea.Program{}
base := stages.NewBaseModel(&queue, viper.GetString("auth-endpoint"))
queue = append(queue,
tea.NewProgram(stages.NewLandingModel(base)))
for len(queue) > 0 {
program := queue[0]
queue = queue[1:]
_, err := program.Run()
if err != nil {
panic(err)
}
}
},
}
func init() {
playerCmd.Flags().
Int("udp-listen-port", 18787, "")
playerCmd.Flags().
StringSlice("udp-endpoints", []string{"localhost:18787"}, "")
playerCmd.Flags().
String("auth-endpoint", "http://localhost:8888", "")
}