MCPcopy Create free account
hub / github.com/cli/cli / IndexFor

Function IndexFor

internal/prompter/test.go:150–157  ·  view source on GitHub ↗
(options []string, answer string)

Source from the content-addressed store, hash-verified

148}
149
150func IndexFor(options []string, answer string) (int, error) {
151 for ix, a := range options {
152 if a == answer {
153 return ix, nil
154 }
155 }
156 return -1, NoSuchAnswerErr(answer, options)
157}
158
159func IndexesFor(options []string, answers ...string) ([]int, error) {
160 indexes := make([]int, len(answers))

Calls 1

NoSuchAnswerErrFunction · 0.85