Merge pull request '[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/cli/RFC.md fully. Find features des...' (#57) from agent/read---spec-code-core-go-cli-rfc-md-full into dev
All checks were successful
Security Scan / security (push) Successful in 21s

This commit is contained in:
Virgil 2026-04-02 06:17:28 +00:00
commit 8ef1a91b30
2 changed files with 11 additions and 0 deletions

View file

@ -165,6 +165,14 @@ func TestChooseMulti_Good_CommasAndRanges(t *testing.T) {
assert.Equal(t, []string{"a", "b", "d"}, vals) assert.Equal(t, []string{"a", "b", "d"}, vals)
} }
func TestChooseMulti_Good_DefaultIndex(t *testing.T) {
SetStdin(strings.NewReader("\n"))
defer SetStdin(nil)
vals := ChooseMulti("Pick", []string{"a", "b", "c"}, WithDefaultIndex[string](1))
assert.Equal(t, []string{"b"}, vals)
}
func TestSetStdin_Good_ResetNil(t *testing.T) { func TestSetStdin_Good_ResetNil(t *testing.T) {
original := stdin original := stdin
t.Cleanup(func() { stdin = original }) t.Cleanup(func() { stdin = original })

View file

@ -441,6 +441,9 @@ func ChooseMulti[T any](prompt string, items []T, opts ...ChooseOption[T]) []T {
// Empty response returns no selections // Empty response returns no selections
if response == "" { if response == "" {
if cfg.defaultN >= 0 {
return []T{items[defaultVisibleIndex(visible, cfg.defaultN)]}
}
return nil return nil
} }