envoid/internal/prompt/string.go
Sagi Dayan 33f99dd65b
All checks were successful
build bin / Make sure build does not fail (push) Successful in 2m51s
Codespell / Check for spelling errors (push) Successful in 22s
Initial commit
Signed-off-by: Sagi Dayan <sagidayan@gmail.com>
2024-12-15 17:41:31 +02:00

21 lines
280 B
Go

package prompt
import (
"bufio"
"fmt"
"os"
"strings"
)
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 strings.TrimSpace(s)
}