Skip to content

Instantly share code, notes, and snippets.

@micahwalter
Created November 2, 2023 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micahwalter/a7d77d1f5aca03b5738787c1f64ecb78 to your computer and use it in GitHub Desktop.
Save micahwalter/a7d77d1f5aca03b5738787c1f64ecb78 to your computer and use it in GitHub Desktop.
func stringPrompt(label string) string {
var s string
r := bufio.NewReader(os.Stdin)
for {
fmt.Fprint(os.Stderr, label+" ")
s, _ = r.ReadString('\n')
if s != "" {
break
}
}
return s
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment