diff options
| -rw-r--r-- | handshake.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/handshake.go b/handshake.go index 68fbedb..d408e1f 100644 --- a/handshake.go +++ b/handshake.go @@ -9,6 +9,7 @@ import ( "net" "os" "slices" + "strings" "git.samanthony.xyz/hose/hosts" "git.samanthony.xyz/hose/key" @@ -142,13 +143,14 @@ func scan(responses []string) (string, error) { if err := scanner.Err(); err != nil { return "", err } - response := scanner.Text() + response := strings.TrimSpace(scanner.Text()) for !slices.Contains(responses, response) { + util.Logf("Please enter one of %q", responses) scanner.Scan() if err := scanner.Err(); err != nil { return "", err } - response = scanner.Text() + response = strings.TrimSpace(scanner.Text()) } return response, nil } |