Skip to content

Commit

Permalink
Reword prompt for generating keys (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
luongthomas authored and AndrewScibek committed Jun 10, 2019
1 parent 6a0393b commit 9a5baa5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package cmd

import (
"fmt"
"os"
"strings"
"syscall"

Expand All @@ -34,15 +35,19 @@ var setupCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
var setupKey string
setupLogin()
fmt.Print("Would you like to generate ssh keys to forward traffic? (Y/n): ")
fmt.Print("\nAn SSH key-pair is required for connecting securely to Holepunch.io, do you want us to create one? \n(Y/N): ")
fmt.Scanln(&setupKey)
setupKey = strings.ToLower(setupKey)
if setupKey != "" && !strings.HasPrefix(setupKey, "y") && !strings.HasPrefix(setupKey, "n") {
reportError("Invalid input", true)
}
if strings.HasPrefix(setupKey, "n") {
fmt.Println("Make sure you set the path to your keys in the config file located at: " + configPath +
"\n You can also generate keys using the generate-key command")
fmt.Print("\nAn existing SSH key-pair can also be used by setting it's path in the config file located at:\n\t")
configFilePath := configPath + string(os.PathSeparator) + ".punch.toml"
green := color.New(color.FgGreen)
green.Printf(configFilePath)
fmt.Print("\n\nOtherwise, a new SSH key pair can be generated by running the command: ")
fmt.Print(color.GreenString("`punch generate-key`"), "\n\n")
return
}
err := generateKey("", "holepunch_key")
Expand Down

0 comments on commit 9a5baa5

Please sign in to comment.