Fix: various bug fix

This commit is contained in:
2025-10-16 07:12:01 +08:00
parent 5bbab63a2c
commit 0dea850cfa
16 changed files with 185 additions and 56 deletions

View File

@@ -2,6 +2,7 @@ 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"
@@ -10,17 +11,16 @@ import (
var playerCmd = &cobra.Command{
Use: "player",
Run: func(cmd *cobra.Command, args []string) {
queue := []*tea.Program{}
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,
})
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 {
for base.Size() > 0 {
p := base.Pop()
if err := p.Run(); err != nil {
panic(err)
}
}