- Split frame.go: extract built-in components to frame_components.go - Replace custom indexOf with strings.Index in frame_test.go - Make prompt.go testable: accept io.Reader via SetStdin, add tests - Decompose runGoQA: extract emitQAJSON and emitQASummary helpers - DRY: centralise loadConfig into cmd/config/cmd.go - Remove hardcoded MACOSX_DEPLOYMENT_TARGET from test/fuzz/cov commands - Add error assertions to coverage_test.go Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36 lines
643 B
Go
36 lines
643 B
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
"maps"
|
|
|
|
"forge.lthn.ai/core/cli/pkg/cli"
|
|
"gopkg.in/yaml.v3"
|
|
)
|
|
|
|
func addListCommand(parent *cli.Command) {
|
|
cmd := cli.NewCommand("list", "List all configuration values", "", func(cmd *cli.Command, args []string) error {
|
|
cfg, err := loadConfig()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
all := maps.Collect(cfg.All())
|
|
if len(all) == 0 {
|
|
cli.Dim("No configuration values set")
|
|
return nil
|
|
}
|
|
|
|
out, err := yaml.Marshal(all)
|
|
if err != nil {
|
|
return cli.Wrap(err, "failed to format config")
|
|
}
|
|
|
|
fmt.Print(string(out))
|
|
return nil
|
|
})
|
|
|
|
cli.WithArgs(cmd, cli.NoArgs())
|
|
|
|
parent.AddCommand(cmd)
|
|
}
|