MCPcopy Create free account
hub / github.com/SamNet-dev/snix / promptYesNo

Function promptYesNo

cmd/snix/wizard.go:275–296  ·  view source on GitHub ↗
(out io.Writer, in *bufio.Reader, prompt string, def bool)

Source from the content-addressed store, hash-verified

273}
274
275func promptYesNo(out io.Writer, in *bufio.Reader, prompt string, def bool) bool {
276 suffix := " (Y/n) "
277 if !def {
278 suffix = " (y/N) "
279 }
280 fmt.Fprint(out, prompt+suffix)
281 line, err := in.ReadString('\n')
282 if err != nil {
283 return def
284 }
285 line = strings.TrimSpace(strings.ToLower(line))
286 switch line {
287 case "":
288 return def
289 case "y", "yes":
290 return true
291 case "n", "no":
292 return false
293 default:
294 return def
295 }
296}
297
298func randomUUID() string {
299 var b [16]byte

Callers 1

runWizardFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected