MCPcopy Create free account
hub / github.com/HashLoad/boss / PromptUntil

Method PromptUntil

msg/msg.go:154–168  ·  view source on GitHub ↗
(opts []string)

Source from the content-addressed store, hash-verified

152}
153
154func (m *Messenger) PromptUntil(opts []string) (string, error) {
155 reader := bufio.NewReader(os.Stdin)
156 for {
157 text, err := reader.ReadString('\n')
158 if err != nil {
159 return "", err
160 }
161
162 for _, c := range opts {
163 if strings.EqualFold(c, strings.TrimSpace(text)) {
164 return c, nil
165 }
166 }
167 }
168}
169
170func (m *Messenger) PromptUntilYorN() bool {
171 res, err := m.PromptUntil([]string{"y", "yes", "n", "no"})

Callers 2

PromptUntilYorNMethod · 0.95
PromptUntilFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected