Read whole line instead of first space-delimited field

This commit is contained in:
The Magician 2024-06-11 10:08:07 +01:00
parent aad3ba9a57
commit c474d3f8bf
1 changed files with 5 additions and 1 deletions

View File

@ -1,7 +1,9 @@
package cli
import (
"bufio"
"fmt"
"os"
"strings"
)
@ -9,7 +11,9 @@ func GetStringResponse(prompt string) string {
fmt.Print(prompt + " ")
var response string
fmt.Scan(&response)
scanner := bufio.NewScanner(os.Stdin)
scanner.Scan()
response = scanner.Text()
return response
}