diff --git a/internal/device/device.go b/internal/device/device.go index 1e9fdab..7c04f6f 100644 --- a/internal/device/device.go +++ b/internal/device/device.go @@ -126,20 +126,18 @@ func promptForName(out *output.Output, fpath string) (string, error) { return "", fmt.Errorf("could not get hostname (prompt default): %w", err) } hostStub := strings.Split(host, ".")[0] - fmt.Printf("\nPlease choose a short name for this device (default: '%s'): ", hostStub) - var input string - scanner := bufio.NewScanner(os.Stdin) - if scanner.Scan() { - input = scanner.Text() - } - if err = scanner.Err(); err != nil { - return "", fmt.Errorf("scanner error: %w", err) + reader := bufio.NewReader(os.Stdin) + fmt.Printf("\nChoose a short name for this device (default: '%s'): ", hostStub) + input, err := reader.ReadString('\n') + name := strings.TrimRight(input, "\n") + if err != nil { + return "", fmt.Errorf("reader error: %w", err) } - if input == "" { + if name == "" { out.Info("Got no input - using default ...") - input = hostStub + name = hostStub } - out.Info(fmt.Sprintf("Device name set to '%s'", input)) + out.Info(fmt.Sprintf("Device name set to '%s'", name)) fmt.Printf("You can change the device name at any time by editing '%s' file\n", fpath) return input, nil } diff --git a/scripts/install.sh b/scripts/install.sh index 16c733c..83569b8 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -187,10 +187,10 @@ printf ' # Show banner if RESH is not loaded in the terminal if [ -z "${__RESH_VERSION-}" ]; then printf ' -############################################################## -# # -# Finish the installation by RESTARTING this terminal! # -# # -############################################################## +┌────────────────────────────────────────────────────────────┐ +│ │ +│ Finish the installation by RESTARTING this terminal! │ +│ │ +└────────────────────────────────────────────────────────────┘ ' fi