Skip to content

Commit d50e600

Browse files
author
kamil cybulski
committed
fix(server): sort server create flags alphabetically
1 parent a9f779e commit d50e600

1 file changed

Lines changed: 16 additions & 18 deletions

File tree

internal/commands/server/create.go

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -251,41 +251,39 @@ func (s *createCommand) InitCommand() {
251251
s.params = createParams{CreateServerRequest: request.CreateServerRequest{}}
252252
def := defaultCreateParams
253253
fs.IntVar(&s.params.AvoidHost, "avoid-host", def.AvoidHost, "Use this to make sure VMs do not reside on specific host. Refers to value from host -attribute. Useful when building HA-environments.")
254-
fs.IntVar(&s.params.Host, "host", def.Host, "Use this to start a VM on a specific private cloud host. Refers to value from host -attribute. Only available in private clouds.")
255254
fs.StringVar(&s.params.BootOrder, "boot-order", def.BootOrder, "The boot device order, disk / cdrom / network or comma separated combination.")
256-
fs.StringVar(&s.params.UserData, "user-data", def.UserData, "Defines URL for a server setup script, or the script body itself.")
257-
fs.StringVar(&s.params.Plan, "plan", def.Plan, "Server plan name. See \"server plans\" command for valid plans. Set to \"custom\" and use `cores` and `memory` options for flexible plan.")
258255
fs.IntVar(&s.params.CoreNumber, "cores", def.CoreNumber, "Number of cores. Only allowed if `plan` option is set to \"custom\".")
259-
fs.IntVar(&s.params.MemoryAmount, "memory", def.MemoryAmount, "Memory amount in MiB. Only allowed if `plan` option is set to \"custom\".")
260-
fs.StringVar(&s.params.Title, "title", def.Title, "A short, informational description.")
256+
config.AddToggleFlag(fs, &s.createPassword, "create-password", def.createPassword, "Create an admin password.")
257+
config.AddEnableOrDisableFlag(fs, &s.firewall, def.firewall, "firewall", "firewall")
258+
config.AddEnableOrDisableFlag(fs, &s.metadata, def.metadata, "metadata", "metadata service")
259+
config.AddEnableOrDisableFlag(fs, &s.remoteAccess, def.remoteAccess, "remote-access", "remote access")
260+
fs.IntVar(&s.params.Host, "host", def.Host, "Use this to start a VM on a specific private cloud host. Refers to value from host -attribute. Only available in private clouds.")
261261
fs.StringVar(&s.params.Hostname, "hostname", def.Hostname, "Server hostname.")
262+
fs.IntVar(&s.params.MemoryAmount, "memory", def.MemoryAmount, "Memory amount in MiB. Only allowed if `plan` option is set to \"custom\".")
263+
fs.StringArrayVar(&s.params.networks, "network", def.networks, "A network interface for the server, multiple can be declared.\nUsage: --network family=IPv4,type=public\n\n--network type=private,network=037a530b-533e-4cef-b6ad-6af8094bb2bc,ip-address=10.0.0.1")
262264
fs.StringVar(&s.params.os, "os", def.os, "Server OS to use (will be the first storage device). Set to empty to fully customise the storages.")
263265
fs.IntVar(&s.params.osStorageSize, "os-storage-size", def.osStorageSize, "OS storage size in GiB. This is only applicable if `os` is also set. Zero value makes the disk equal to the minimum size of the template.")
264-
fs.StringVar(&s.params.Zone, "zone", def.Zone, "Zone where to create the server.")
265266
fs.StringVar(&s.params.PasswordDelivery, "password-delivery", def.PasswordDelivery, "Defines how password is delivered. Available: email, sms")
267+
fs.StringVar(&s.params.Plan, "plan", def.Plan, "Server plan name. See \"server plans\" command for valid plans. Set to \"custom\" and use `cores` and `memory` options for flexible plan.")
268+
fs.StringVar(&s.params.RemoteAccessPassword, "remote-access-password", def.RemoteAccessPassword, "Defines the remote access password.")
269+
fs.StringVar(&s.params.RemoteAccessType, "remote-access-type", def.RemoteAccessType, "Set a remote access type. Available: vnc, spice")
266270
fs.StringVar(&s.params.SimpleBackup, "simple-backup", def.SimpleBackup, "Simple backup rule. Format (HHMM,{dailies,weeklies,monthlies}). Example: 2300,dailies")
271+
fs.StringSliceVar(&s.params.sshKeys, "ssh-keys", def.sshKeys, "Add one or more SSH keys to the admin account. Accepted values are SSH public keys or filenames from where to read the keys.")
272+
fs.StringArrayVar(&s.params.storages, "storage", def.storages, "A storage connected to the server, multiple can be declared.\nUsage: --storage action=attach,storage=01000000-0000-4000-8000-000020010301,type=cdrom")
267273
fs.StringVar(&s.params.TimeZone, "time-zone", def.TimeZone, "Time zone to set the RTC to.")
274+
fs.StringVar(&s.params.Title, "title", def.Title, "A short, informational description.")
275+
fs.StringVar(&s.params.UserData, "user-data", def.UserData, "Defines URL for a server setup script, or the script body itself.")
276+
fs.StringVar(&s.params.username, "username", def.username, "Admin account username.")
268277
fs.StringVar(&s.params.VideoModel, "video-model", def.VideoModel, "Video interface model of the server. Available: vga, cirrus")
269-
config.AddEnableOrDisableFlag(fs, &s.firewall, def.firewall, "firewall", "firewall")
278+
fs.StringVar(&s.params.Zone, "zone", def.Zone, "Zone where to create the server.")
270279
// fs.BoolVar(&s.params.firewall, "firewall", def.firewall, "Enables the firewall. You can manage firewall rules with the firewall command.")
271-
config.AddEnableOrDisableFlag(fs, &s.metadata, def.metadata, "metadata", "metadata service")
272280
// fs.BoolVar(&s.params.metadata, "metadata", def.metadata, "Enable metadata service.")
273-
fs.StringArrayVar(&s.params.storages, "storage", def.storages, "A storage connected to the server, multiple can be declared.\nUsage: --storage action=attach,storage=01000000-0000-4000-8000-000020010301,type=cdrom")
274-
fs.StringArrayVar(&s.params.networks, "network", def.networks, "A network interface for the server, multiple can be declared.\nUsage: --network family=IPv4,type=public\n\n--network type=private,network=037a530b-533e-4cef-b6ad-6af8094bb2bc,ip-address=10.0.0.1")
275-
config.AddToggleFlag(fs, &s.createPassword, "create-password", def.createPassword, "Create an admin password.")
276-
fs.StringVar(&s.params.username, "username", def.username, "Admin account username.")
277-
fs.StringSliceVar(&s.params.sshKeys, "ssh-keys", def.sshKeys, "Add one or more SSH keys to the admin account. Accepted values are SSH public keys or filenames from where to read the keys.")
278-
config.AddEnableOrDisableFlag(fs, &s.remoteAccess, def.remoteAccess, "remote-access", "remote access")
279281
// fs.BoolVar(&s.params.remoteAccess, "remote-access-enabled", def.remoteAccess, "Enables or disables the remote access.")
280-
fs.StringVar(&s.params.RemoteAccessType, "remote-access-type", def.RemoteAccessType, "Set a remote access type. Available: vnc, spice")
281-
fs.StringVar(&s.params.RemoteAccessPassword, "remote-access-password", def.RemoteAccessPassword, "Defines the remote access password.")
282282
s.AddFlags(fs)
283283
}
284284

285285
// ExecuteWithoutArguments implements commands.NoArgumentCommand
286286
func (s *createCommand) ExecuteWithoutArguments(exec commands.Executor) (output.Output, error) {
287-
fmt.Printf("\033[31m Plan: %s | Cores: %d | Mem: %d\033[0m", s.params.Plan, s.params.CoreNumber, s.params.MemoryAmount)
288-
289287
if s.params.Hostname == "" || s.params.Zone == "" {
290288
return nil, fmt.Errorf("hostname, zone and some password delivery method are required")
291289
}

0 commit comments

Comments
 (0)