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
All checks were successful
Security Scan / security (push) Successful in 21s
This commit is contained in:
commit
8ef1a91b30
2 changed files with 11 additions and 0 deletions
|
|
@ -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 })
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue