Skip to content

Commit

Permalink
Update documentation and prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
bobheadxi committed Jan 22, 2018
1 parent 479f2e8 commit cac9af4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ $> inertia init

$> inertia remote add glcoud 35.227.171.49 -u root -i /path/to/my/.ssh/id_rsa
Remote 'glcoud' added.
$> inertia remote add gcloud
Enter location of PEM file (leave blank to use '/Users/yourspecialname/.ssh/id_rsa'):
/path/to/my/.ssh/id_rsa
Enter IP address of remote:
35.227.171.49
Enter user:
root
Remote 'gcloud' added.
You can now run 'inertia gcloud init' to set this remote
up for continuous deployment.

$> inertia gcloud init
Bootstrapping remote
Expand Down
26 changes: 12 additions & 14 deletions cmd/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ of the VPS. Must run 'inertia init' in your repository before using.
Example:
inerta remote add gcloud 35.123.55.12 -i /Users/path/to/pem
inerta remote add gcloud
inerta remote bootstrap gcloud
inerta remote status gcloud`,
Run: func(cmd *cobra.Command, args []string) {
Expand All @@ -62,7 +62,7 @@ inerta remote status gcloud`,

// addCmd represents the remote add command
var addCmd = &cobra.Command{
Use: "add",
Use: "add [REMOTE]",
Short: "Add a reference to a remote VPS instance",
Long: `Add a reference to a remote VPS instance. Requires
information about the VPS including IP address, user and a PEM
Expand All @@ -77,25 +77,29 @@ file. Specify a VPS name.`,

port, _ := cmd.Flags().GetString("port")

homeEnvVar := os.Getenv("HOME")
sshDir := filepath.Join(homeEnvVar, ".ssh")
defaultSSHLoc := filepath.Join(sshDir, "id_rsa")

var response string
fmt.Printf("Enter location of PEM file: ")
fmt.Println("Enter location of PEM file (leave blank to use '" + defaultSSHLoc + "'): ")
_, err = fmt.Scanln(&response)
if err != nil {
log.Fatal(err)
response = defaultSSHLoc
}
pemLoc := response

fmt.Printf("Enter IP address of remote: ")
fmt.Printf("Enter IP address of remote: \n")
_, err = fmt.Scanln(&response)
if err != nil {
log.Fatal(err)
log.Fatal("That is not a valid IP address - please try again.")
}
address := response

fmt.Printf("Enter user: ")
fmt.Printf("Enter user: \n")
_, err = fmt.Scanln(&response)
if err != nil {
log.Fatal(err)
log.Fatal("That is not a valid user - please try again.")
}
user := response

Expand Down Expand Up @@ -185,10 +189,6 @@ func init() {
remoteCmd.AddCommand(addCmd)
remoteCmd.AddCommand(statusCmd)

homeEnvVar := os.Getenv("HOME")
sshDir := filepath.Join(homeEnvVar, ".ssh")
defaultSSHLoc := filepath.Join(sshDir, "id_rsa")

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
Expand All @@ -198,7 +198,5 @@ func init() {
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
remoteCmd.Flags().BoolP("verbose", "v", false, "Verbose output")
addCmd.Flags().StringP("user", "u", "root", "User for SSH access")
addCmd.Flags().StringP("identity", "i", defaultSSHLoc, "PEM file location")
addCmd.Flags().StringP("port", "p", daemon.DefaultPort, "Daemon port")
}

0 comments on commit cac9af4

Please sign in to comment.