Skip to content

Commit cacdaa4

Browse files
philippgillethcyron
authored andcommitted
Print IP address after a server was created (#116)
Closes #107.
1 parent 4d565ac commit cacdaa4

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

cli/server_create.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,13 @@ func runServerCreate(cli *CLI, cmd *cobra.Command, args []string) error {
7171
return err
7272
}
7373

74+
fmt.Printf("Server %d created\n", result.Server.ID)
75+
fmt.Printf("IPv4: %s\n", result.Server.PublicNet.IPv4.IP.String())
76+
77+
// Only print the root password if it's not empty,
78+
// which is only the case if it wasn't created with an SSH key.
7479
if result.RootPassword != "" {
75-
fmt.Printf("Server %d created with root password: %s\n", result.Server.ID, result.RootPassword)
76-
} else {
77-
fmt.Printf("Server %d created\n", result.Server.ID)
80+
fmt.Printf("Root password: %s\n", result.RootPassword)
7881
}
7982

8083
return nil

0 commit comments

Comments
 (0)