1package cmd23import (4 "fmt"56 "github.com/FelineStateMachine/puzzletea/config"7 sessionflow "github.com/FelineStateMachine/puzzletea/session"8 "github.com/FelineStateMachine/puzzletea/store"910 "github.com/spf13/cobra"11)1213var continueCmd = &cobra.Command{14 Use: "continue <name>",15 Short: "Resume a saved game by name",16 Long: "Resume a previously saved game using its unique name.\nUse 'puzzletea list' to see available saved games.",17 Args: cobra.ExactArgs(1),18 RunE: func(cmd *cobra.Command, args []string) error {19 return continueGameFn(args[0], loadActiveConfig())20 },21}2223// continueGame looks up a saved game by name and launches the TUI.24func continueGame(name string, cfg *config.Config) error {25 s, err := openStoreFn(cfg.DBPath)26 if err != nil {27 return err28 }29 defer s.Close()3031 rec, err := s.GetGameByName(name)32 if err != nil {33 return err34 }35 if rec == nil {36 return fmt.Errorf("no saved game found with name %q\nRun 'puzzletea list' to see available games.", name)37 }3839 g, err := sessionflow.ImportRecord(rec)40 if err != nil {41 return err42 }4344 completed := rec.Status == store.StatusCompleted45 return runGameProgramFn(s, cfg, activeConfigPath(), g, rec.ID, completed)46}