envoid/internal/prompt/string.go
Sagi Dayan 687d1ee475
Some checks failed
ci/ci / check for spelling errors (pull_request) Successful in 22s
ci/ci / code quality (pull_request) Failing after 24s
ci/ci / make sure build does not fail (pull_request) Has been skipped
ci/ci / notify-fail (pull_request) Successful in 18s
Added lint to the CI. formatted all code accordingly
Signed-off-by: Sagi Dayan <sagidayan@gmail.com>
2024-12-16 23:25:28 +02:00

25 lines
292 B
Go

package prompt
import (
"bufio"
"fmt"
"os"
"strings"
)
func StringPrompt(label string) string {
var str string
r := bufio.NewReader(os.Stdin)
for {
fmt.Fprint(os.Stderr, label+" ")
str, _ = r.ReadString('\n')
if str != "" {
break
}
}
return strings.TrimSpace(str)
}