Feat: login done

This commit is contained in:
2025-09-05 03:59:25 +08:00
parent 6d7074198f
commit f527230f1e
43 changed files with 2090 additions and 93 deletions

44
cmd/play/root.go Normal file
View File

@@ -0,0 +1,44 @@
package play
import (
"gitea.konchin.com/ytshih/inp2025/game/plays"
"gitea.konchin.com/ytshih/inp2025/game/tracing"
tea "github.com/charmbracelet/bubbletea"
"github.com/go-resty/resty/v2"
"github.com/spf13/cobra"
)
var RootCmd = &cobra.Command{
Use: "play",
Short: "Play game",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
appname := "game-tui"
tracing.InitTracer(appname)
client := resty.New().
SetBaseURL(args[0]).
SetDisableWarn(true)
queue := []*tea.Program{}
queue = append(queue,
tea.NewProgram(plays.NewLanding(plays.NewBase(client))))
for len(queue) > 0 {
program := queue[0]
queue = queue[1:]
res, err := program.Run()
if err != nil {
panic(err)
}
err = res.(plays.Next).Next(&queue)
if err != nil {
panic(err)
}
}
},
}
func init() {
}