38 lines
878 B
Go
38 lines
878 B
Go
package main
|
|
|
|
import (
|
|
"gitea.konchin.com/ytshih/inp2025/stages"
|
|
"gitea.konchin.com/ytshih/inp2025/types"
|
|
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) {
|
|
base := stages.NewBaseModel(viper.GetString("auth-endpoint"))
|
|
p := tea.NewProgram(stages.NewLandingModel(base))
|
|
base.Push(types.Program{
|
|
Run: func() error { _, err := p.Run(); return err },
|
|
Stage: types.StageLanding,
|
|
})
|
|
|
|
for base.Size() > 0 {
|
|
p := base.Pop()
|
|
if err := p.Run(); 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", "")
|
|
}
|