refactor: moved a lot of flags & added comments
Comments added to fix the golint errors on exported things need comments
This commit is contained in:
@ -14,10 +14,10 @@ var serverAddCommand = &cli.Command{
|
||||
ArgsUsage: "<host> [<user>] [<port>]",
|
||||
Description: "[<user>], [<port>] SSH connection details",
|
||||
Action: func(c *cli.Context) error {
|
||||
arg_len := c.Args().Len()
|
||||
argLen := c.Args().Len()
|
||||
args := c.Args().Slice()
|
||||
if arg_len < 3 {
|
||||
args = append(args, make([]string, 3-arg_len)...)
|
||||
if argLen < 3 {
|
||||
args = append(args, make([]string, 3-argLen)...)
|
||||
}
|
||||
if err := client.CreateContext(args[0], args[1], args[2]); err != nil {
|
||||
logrus.Fatal(err)
|
||||
|
@ -8,11 +8,11 @@ import (
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
var HetznerCloudType string
|
||||
var HetznerCloudImage string
|
||||
var HetznerCloudSSHKeys cli.StringSlice
|
||||
var HetznerCloudLocation string
|
||||
var HetznerCloudAPIToken string
|
||||
var hetznerCloudType string
|
||||
var hetznerCloudImage string
|
||||
var hetznerCloudSSHKeys cli.StringSlice
|
||||
var hetznerCloudLocation string
|
||||
var hetznerCloudAPIToken string
|
||||
var serverNewHetznerCloudCommand = &cli.Command{
|
||||
Name: "hetzner",
|
||||
Usage: "Create a new Hetzner virtual server",
|
||||
@ -32,7 +32,7 @@ environment variable or otherwise passing the "--env/-e" flag.
|
||||
Name: "type",
|
||||
Aliases: []string{"t"},
|
||||
Usage: "Server type",
|
||||
Destination: &HetznerCloudType,
|
||||
Destination: &hetznerCloudType,
|
||||
Value: "cx11",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
@ -40,27 +40,27 @@ environment variable or otherwise passing the "--env/-e" flag.
|
||||
Aliases: []string{"i"},
|
||||
Usage: "Image type",
|
||||
Value: "debian-10",
|
||||
Destination: &HetznerCloudImage,
|
||||
Destination: &hetznerCloudImage,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "ssh-keys",
|
||||
Aliases: []string{"s"},
|
||||
Usage: "SSH keys",
|
||||
Destination: &HetznerCloudSSHKeys,
|
||||
Destination: &hetznerCloudSSHKeys,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "location",
|
||||
Aliases: []string{"l"},
|
||||
Usage: "Server location",
|
||||
Value: "hel1",
|
||||
Destination: &HetznerCloudLocation,
|
||||
Destination: &hetznerCloudLocation,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "token",
|
||||
Aliases: []string{"T"},
|
||||
Usage: "Hetzner Cloud API token",
|
||||
EnvVars: []string{"HCLOUD_API_TOKEN"},
|
||||
Destination: &HetznerCloudAPIToken,
|
||||
Destination: &hetznerCloudAPIToken,
|
||||
},
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
@ -70,7 +70,7 @@ environment variable or otherwise passing the "--env/-e" flag.
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
client := hcloud.NewClient(hcloud.WithToken(HetznerCloudAPIToken))
|
||||
client := hcloud.NewClient(hcloud.WithToken(hetznerCloudAPIToken))
|
||||
|
||||
// var sshkeys []hcloud.SSHKey
|
||||
// for _, sshkey := range HetznerCloudSSHKeys {
|
||||
@ -80,8 +80,8 @@ environment variable or otherwise passing the "--env/-e" flag.
|
||||
// TODO: finish passing arguments
|
||||
serverOpts := hcloud.ServerCreateOpts{
|
||||
Name: name,
|
||||
ServerType: &hcloud.ServerType{Name: HetznerCloudType},
|
||||
Image: &hcloud.Image{Name: HetznerCloudImage},
|
||||
ServerType: &hcloud.ServerType{Name: hetznerCloudType},
|
||||
Image: &hcloud.Image{Name: hetznerCloudImage},
|
||||
// SSHKeys: HetznerCloudSSHKeys,
|
||||
// Location: HetznerCloudLocation,
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
// Reminder: The list commands are in is the order they appear in the help menu
|
||||
// ServerCommand defines the `abra server` command and ets subcommands
|
||||
var ServerCommand = &cli.Command{
|
||||
Name: "server",
|
||||
ArgsUsage: "<host>",
|
||||
|
Reference in New Issue
Block a user