fix(namepool): display correct theme from config.json (#890)

The 'gt namepool' command was showing 'mad-max' for all rigs because
it created the pool with defaults instead of loading config. This made
it impossible to see if a rig had custom theme settings.

Load config before creating the pool, matching the logic in manager.go
that actually spawns polecats. Theme and CustomNames come from
settings/config.json, not from the state file.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Christian Sieber
2026-01-24 21:48:12 -08:00
committed by GitHub
parent 533caf8e4b
commit 63d60f1dcd

View File

@@ -83,8 +83,25 @@ func runNamepool(cmd *cobra.Command, args []string) error {
return fmt.Errorf("not in a rig directory") return fmt.Errorf("not in a rig directory")
} }
// Load pool // Load settings for namepool config
pool := polecat.NewNamePool(rigPath, rigName) settingsPath := filepath.Join(rigPath, "settings", "config.json")
var pool *polecat.NamePool
settings, err := config.LoadRigSettings(settingsPath)
if err == nil && settings.Namepool != nil {
// Use configured namepool settings
pool = polecat.NewNamePoolWithConfig(
rigPath,
rigName,
settings.Namepool.Style,
settings.Namepool.Names,
settings.Namepool.MaxBeforeNumbering,
)
} else {
// Use defaults
pool = polecat.NewNamePool(rigPath, rigName)
}
if err := pool.Load(); err != nil { if err := pool.Load(); err != nil {
// Pool doesn't exist yet, show defaults // Pool doesn't exist yet, show defaults
fmt.Printf("Rig: %s\n", rigName) fmt.Printf("Rig: %s\n", rigName)
@@ -104,9 +121,8 @@ func runNamepool(cmd *cobra.Command, args []string) error {
fmt.Printf("In use: %s\n", strings.Join(activeNames, ", ")) fmt.Printf("In use: %s\n", strings.Join(activeNames, ", "))
} }
// Check if configured // Check if configured (already loaded above)
settingsPath := filepath.Join(rigPath, "settings", "config.json") if settings.Namepool != nil {
if settings, err := config.LoadRigSettings(settingsPath); err == nil && settings.Namepool != nil {
fmt.Printf("(configured in settings/config.json)\n") fmt.Printf("(configured in settings/config.json)\n")
} }