MCPcopy Create free account
hub / github.com/cloudspannerecosystem/spanner-cli / confirm

Function confirm

cli.go:534–549  ·  view source on GitHub ↗
(out io.Writer, msg string)

Source from the content-addressed store, hash-verified

532}
533
534func confirm(out io.Writer, msg string) bool {
535 fmt.Fprintf(out, "%s [yes/no] ", msg)
536
537 s := bufio.NewScanner(os.Stdin)
538 for {
539 s.Scan()
540 switch strings.ToLower(s.Text()) {
541 case "yes":
542 return true
543 case "no":
544 return false
545 default:
546 fmt.Fprint(out, "Please answer yes or no: ")
547 }
548 }
549}
550
551func handleInterrupt(cancel context.CancelFunc) {
552 c := make(chan os.Signal, 1)

Callers 1

RunInteractiveMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected