diff --git a/args_short.go b/args_short.go new file mode 100644 index 000000000..7b6140857 --- /dev/null +++ b/args_short.go @@ -0,0 +1,19 @@ +/* +Copyright 2016 The Doctl Authors All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package doctl + +const ( + // ArgShortDeleteForce forces deletion actions + ArgShortDeleteForce = "f" +) diff --git a/commands/actions.go b/commands/actions.go index 0c99708a2..eafbda84e 100644 --- a/commands/actions.go +++ b/commands/actions.go @@ -40,16 +40,16 @@ func Actions() *Command { cmdActionList := CmdBuilder(cmd, RunCmdActionList, "list", "list actions", Writer, aliasOpt("ls"), displayerType(&action{}), docCategories("action")) - AddStringFlag(cmdActionList, doctl.ArgActionResourceType, "", "Action resource type") - AddStringFlag(cmdActionList, doctl.ArgActionRegion, "", "Action region") - AddStringFlag(cmdActionList, doctl.ArgActionAfter, "", "Action completed after in RFC3339 format") - AddStringFlag(cmdActionList, doctl.ArgActionBefore, "", "Action completed before in RFC3339 format") - AddStringFlag(cmdActionList, doctl.ArgActionStatus, "", "Action status") - AddStringFlag(cmdActionList, doctl.ArgActionType, "", "Action type") + AddStringFlag(cmdActionList, doctl.ArgActionResourceType, "", "", "Action resource type") + AddStringFlag(cmdActionList, doctl.ArgActionRegion, "", "", "Action region") + AddStringFlag(cmdActionList, doctl.ArgActionAfter, "", "", "Action completed after in RFC3339 format") + AddStringFlag(cmdActionList, doctl.ArgActionBefore, "", "", "Action completed before in RFC3339 format") + AddStringFlag(cmdActionList, doctl.ArgActionStatus, "", "", "Action status") + AddStringFlag(cmdActionList, doctl.ArgActionType, "", "", "Action type") cmdActionWait := CmdBuilder(cmd, RunCmdActionWait, "wait ACTIONID", "wait for action to complete", Writer, aliasOpt("w"), displayerType(&action{}), docCategories("action")) - AddIntFlag(cmdActionWait, doctl.ArgPollTime, 5, "Re-poll time in seconds") + AddIntFlag(cmdActionWait, doctl.ArgPollTime, "", 5, "Re-poll time in seconds") return cmd } diff --git a/commands/doit.go b/commands/doit.go index e93d6d512..34fcfa806 100644 --- a/commands/doit.go +++ b/commands/doit.go @@ -213,9 +213,9 @@ func isBeta() bool { } // AddStringFlag adds a string flag to a command. -func AddStringFlag(cmd *Command, name, dflt, desc string, opts ...flagOpt) { +func AddStringFlag(cmd *Command, name, shorthand, dflt, desc string, opts ...flagOpt) { fn := flagName(cmd, name) - cmd.Flags().String(name, dflt, desc) + cmd.Flags().StringP(name, shorthand, dflt, desc) for _, o := range opts { o(cmd, name, fn) @@ -225,9 +225,9 @@ func AddStringFlag(cmd *Command, name, dflt, desc string, opts ...flagOpt) { } // AddIntFlag adds an integr flag to a command. -func AddIntFlag(cmd *Command, name string, def int, desc string, opts ...flagOpt) { +func AddIntFlag(cmd *Command, name, shorthand string, def int, desc string, opts ...flagOpt) { fn := flagName(cmd, name) - cmd.Flags().Int(name, def, desc) + cmd.Flags().IntP(name, shorthand, def, desc) viper.BindPFlag(fn, cmd.Flags().Lookup(name)) for _, o := range opts { @@ -236,9 +236,9 @@ func AddIntFlag(cmd *Command, name string, def int, desc string, opts ...flagOpt } // AddBoolFlag adds a boolean flag to a command. -func AddBoolFlag(cmd *Command, name string, def bool, desc string, opts ...flagOpt) { +func AddBoolFlag(cmd *Command, name, shorthand string, def bool, desc string, opts ...flagOpt) { fn := flagName(cmd, name) - cmd.Flags().Bool(name, def, desc) + cmd.Flags().BoolP(name, shorthand, def, desc) viper.BindPFlag(fn, cmd.Flags().Lookup(name)) for _, o := range opts { @@ -247,9 +247,9 @@ func AddBoolFlag(cmd *Command, name string, def bool, desc string, opts ...flagO } // AddStringSliceFlag adds a string slice flag to a command. -func AddStringSliceFlag(cmd *Command, name string, def []string, desc string, opts ...flagOpt) { +func AddStringSliceFlag(cmd *Command, name, shorthand string, def []string, desc string, opts ...flagOpt) { fn := flagName(cmd, name) - cmd.Flags().StringSlice(name, def, desc) + cmd.Flags().StringSliceP(name, shorthand, def, desc) viper.BindPFlag(fn, cmd.Flags().Lookup(name)) for _, o := range opts { @@ -401,8 +401,8 @@ func cmdBuilderWithInit(parent *Command, cr CmdRunner, cliText, desc string, out if cols := c.fmtCols; cols != nil { formatHelp := fmt.Sprintf("Columns for output in a comma seperated list. Possible values: %s", strings.Join(cols, ",")) - AddStringFlag(c, doctl.ArgFormat, "", formatHelp) - AddBoolFlag(c, doctl.ArgNoHeader, false, "hide headers") + AddStringFlag(c, doctl.ArgFormat, "", "", formatHelp) + AddBoolFlag(c, doctl.ArgNoHeader, "", false, "hide headers") } return c diff --git a/commands/domains.go b/commands/domains.go index bbaadd91f..d7ce30ae9 100644 --- a/commands/domains.go +++ b/commands/domains.go @@ -38,7 +38,7 @@ func Domain() *Command { cmdDomainCreate := CmdBuilder(cmd, RunDomainCreate, "create ", "create domain", Writer, aliasOpt("c"), displayerType(&domain{}), docCategories("domain")) - AddStringFlag(cmdDomainCreate, doctl.ArgIPAddress, "", "IP address", requiredOpt()) + AddStringFlag(cmdDomainCreate, doctl.ArgIPAddress, "", "", "IP address", requiredOpt()) CmdBuilder(cmd, RunDomainList, "list", "list domains", Writer, aliasOpt("ls"), displayerType(&domain{}), docCategories("domain")) @@ -59,29 +59,29 @@ func Domain() *Command { cmdRecordList := CmdBuilder(cmdRecord, RunRecordList, "list ", "list records", Writer, aliasOpt("ls"), displayerType(&domainRecord{}), docCategories("domain")) - AddStringFlag(cmdRecordList, doctl.ArgDomainName, "", "Domain name") + AddStringFlag(cmdRecordList, doctl.ArgDomainName, "", "", "Domain name") cmdRecordCreate := CmdBuilder(cmdRecord, RunRecordCreate, "create ", "create record", Writer, aliasOpt("c"), displayerType(&domainRecord{}), docCategories("domain")) - AddStringFlag(cmdRecordCreate, doctl.ArgRecordType, "", "Record type") - AddStringFlag(cmdRecordCreate, doctl.ArgRecordName, "", "Record name") - AddStringFlag(cmdRecordCreate, doctl.ArgRecordData, "", "Record data") - AddIntFlag(cmdRecordCreate, doctl.ArgRecordPriority, 0, "Record priority") - AddIntFlag(cmdRecordCreate, doctl.ArgRecordPort, 0, "Record port") - AddIntFlag(cmdRecordCreate, doctl.ArgRecordWeight, 0, "Record weight") + AddStringFlag(cmdRecordCreate, doctl.ArgRecordType, "", "", "Record type") + AddStringFlag(cmdRecordCreate, doctl.ArgRecordName, "", "", "Record name") + AddStringFlag(cmdRecordCreate, doctl.ArgRecordData, "", "", "Record data") + AddIntFlag(cmdRecordCreate, doctl.ArgRecordPriority, "", 0, "Record priority") + AddIntFlag(cmdRecordCreate, doctl.ArgRecordPort, "", 0, "Record port") + AddIntFlag(cmdRecordCreate, doctl.ArgRecordWeight, "", 0, "Record weight") CmdBuilder(cmdRecord, RunRecordDelete, "delete ", "delete record", Writer, aliasOpt("d"), docCategories("domain")) cmdRecordUpdate := CmdBuilder(cmdRecord, RunRecordUpdate, "update ", "update record", Writer, aliasOpt("u"), displayerType(&domainRecord{}), docCategories("domain")) - AddIntFlag(cmdRecordUpdate, doctl.ArgRecordID, 0, "Record ID") - AddStringFlag(cmdRecordUpdate, doctl.ArgRecordType, "", "Record type") - AddStringFlag(cmdRecordUpdate, doctl.ArgRecordName, "", "Record name") - AddStringFlag(cmdRecordUpdate, doctl.ArgRecordData, "", "Record data") - AddIntFlag(cmdRecordUpdate, doctl.ArgRecordPriority, 0, "Record priority") - AddIntFlag(cmdRecordUpdate, doctl.ArgRecordPort, 0, "Record port") - AddIntFlag(cmdRecordUpdate, doctl.ArgRecordWeight, 0, "Record weight") + AddIntFlag(cmdRecordUpdate, doctl.ArgRecordID, "", 0, "Record ID") + AddStringFlag(cmdRecordUpdate, doctl.ArgRecordType, "", "", "Record type") + AddStringFlag(cmdRecordUpdate, doctl.ArgRecordName, "", "", "Record name") + AddStringFlag(cmdRecordUpdate, doctl.ArgRecordData, "", "", "Record data") + AddIntFlag(cmdRecordUpdate, doctl.ArgRecordPriority, "", 0, "Record priority") + AddIntFlag(cmdRecordUpdate, doctl.ArgRecordPort, "", 0, "Record port") + AddIntFlag(cmdRecordUpdate, doctl.ArgRecordWeight, "", 0, "Record weight") return cmd } diff --git a/commands/droplet_actions.go b/commands/droplet_actions.go index 0a4ce6e18..7d54cec91 100644 --- a/commands/droplet_actions.go +++ b/commands/droplet_actions.go @@ -61,94 +61,94 @@ func DropletAction() *Command { cmdDropletActionGet := CmdBuilder(cmd, RunDropletActionGet, "get", "get droplet action", Writer, aliasOpt("g"), displayerType(&action{}), docCategories("droplet")) - AddIntFlag(cmdDropletActionGet, doctl.ArgActionID, 0, "Action ID", requiredOpt()) + AddIntFlag(cmdDropletActionGet, doctl.ArgActionID, "", 0, "Action ID", requiredOpt()) cmdDropletActionDisableBackups := CmdBuilder(cmd, RunDropletActionDisableBackups, "disable-backups ", "disable backups", Writer, displayerType(&action{}), docCategories("droplet")) - AddBoolFlag(cmdDropletActionDisableBackups, doctl.ArgCommandWait, false, "Wait for action to complete") + AddBoolFlag(cmdDropletActionDisableBackups, doctl.ArgCommandWait, "", false, "Wait for action to complete") cmdDropletActionReboot := CmdBuilder(cmd, RunDropletActionReboot, "reboot ", "reboot droplet", Writer, displayerType(&action{}), docCategories("droplet")) - AddBoolFlag(cmdDropletActionReboot, doctl.ArgCommandWait, false, "Wait for action to complete") + AddBoolFlag(cmdDropletActionReboot, doctl.ArgCommandWait, "", false, "Wait for action to complete") cmdDropletActionPowerCycle := CmdBuilder(cmd, RunDropletActionPowerCycle, "power-cycle ", "power cycle droplet", Writer, displayerType(&action{}), docCategories("droplet")) - AddBoolFlag(cmdDropletActionPowerCycle, doctl.ArgCommandWait, false, "Wait for action to complete") + AddBoolFlag(cmdDropletActionPowerCycle, doctl.ArgCommandWait, "", false, "Wait for action to complete") cmdDropletActionShutdown := CmdBuilder(cmd, RunDropletActionShutdown, "shutdown ", "shutdown droplet", Writer, displayerType(&action{}), docCategories("droplet")) - AddBoolFlag(cmdDropletActionShutdown, doctl.ArgCommandWait, false, "Wait for action to complete") + AddBoolFlag(cmdDropletActionShutdown, doctl.ArgCommandWait, "", false, "Wait for action to complete") cmdDropletActionPowerOff := CmdBuilder(cmd, RunDropletActionPowerOff, "power-off ", "power off droplet", Writer, displayerType(&action{}), docCategories("droplet")) - AddBoolFlag(cmdDropletActionPowerOff, doctl.ArgCommandWait, false, "Wait for action to complete") + AddBoolFlag(cmdDropletActionPowerOff, doctl.ArgCommandWait, "", false, "Wait for action to complete") cmdDropletActionPowerOn := CmdBuilder(cmd, RunDropletActionPowerOn, "power-on ", "power on droplet", Writer, displayerType(&action{}), docCategories("droplet")) - AddBoolFlag(cmdDropletActionPowerOn, doctl.ArgCommandWait, false, "Wait for action to complete") + AddBoolFlag(cmdDropletActionPowerOn, doctl.ArgCommandWait, "", false, "Wait for action to complete") cmdDropletActionPasswordReset := CmdBuilder(cmd, RunDropletActionPasswordReset, "password-reset ", "password reset droplet", Writer, displayerType(&action{}), docCategories("droplet")) - AddBoolFlag(cmdDropletActionPasswordReset, doctl.ArgCommandWait, false, "Wait for action to complete") + AddBoolFlag(cmdDropletActionPasswordReset, doctl.ArgCommandWait, "", false, "Wait for action to complete") cmdDropletActionEnableIPv6 := CmdBuilder(cmd, RunDropletActionEnableIPv6, "enable-ipv6 ", "enable ipv6", Writer, displayerType(&action{}), docCategories("droplet")) - AddBoolFlag(cmdDropletActionEnableIPv6, doctl.ArgCommandWait, false, "Wait for action to complete") + AddBoolFlag(cmdDropletActionEnableIPv6, doctl.ArgCommandWait, "", false, "Wait for action to complete") cmdDropletActionEnablePrivateNetworking := CmdBuilder(cmd, RunDropletActionEnablePrivateNetworking, "enable-private-networking ", "enable private networking", Writer, displayerType(&action{}), docCategories("droplet")) - AddBoolFlag(cmdDropletActionEnablePrivateNetworking, doctl.ArgCommandWait, false, "Wait for action to complete") + AddBoolFlag(cmdDropletActionEnablePrivateNetworking, doctl.ArgCommandWait, "", false, "Wait for action to complete") cmdDropletActionUpgrade := CmdBuilder(cmd, RunDropletActionUpgrade, "upgrade ", "upgrade droplet", Writer, displayerType(&action{}), docCategories("droplet")) - AddBoolFlag(cmdDropletActionUpgrade, doctl.ArgCommandWait, false, "Wait for action to complete") + AddBoolFlag(cmdDropletActionUpgrade, doctl.ArgCommandWait, "", false, "Wait for action to complete") cmdDropletActionRestore := CmdBuilder(cmd, RunDropletActionRestore, "restore ", "restore backup", Writer, displayerType(&action{}), docCategories("droplet")) - AddIntFlag(cmdDropletActionRestore, doctl.ArgImageID, 0, "Image ID", requiredOpt()) - AddBoolFlag(cmdDropletActionRestore, doctl.ArgCommandWait, false, "Wait for action to complete") + AddIntFlag(cmdDropletActionRestore, doctl.ArgImageID, "", 0, "Image ID", requiredOpt()) + AddBoolFlag(cmdDropletActionRestore, doctl.ArgCommandWait, "", false, "Wait for action to complete") cmdDropletActionResize := CmdBuilder(cmd, RunDropletActionResize, "resize ", "resize droplet", Writer, displayerType(&action{}), docCategories("droplet")) - AddBoolFlag(cmdDropletActionResize, doctl.ArgResizeDisk, false, "Resize disk") - AddStringFlag(cmdDropletActionResize, doctl.ArgSizeSlug, "", "New size") - AddBoolFlag(cmdDropletActionResize, doctl.ArgCommandWait, false, "Wait for action to complete") + AddBoolFlag(cmdDropletActionResize, doctl.ArgResizeDisk, "", false, "Resize disk") + AddStringFlag(cmdDropletActionResize, doctl.ArgSizeSlug, "", "", "New size") + AddBoolFlag(cmdDropletActionResize, doctl.ArgCommandWait, "", false, "Wait for action to complete") cmdDropletActionRebuild := CmdBuilder(cmd, RunDropletActionRebuild, "rebuild ", "rebuild droplet", Writer, displayerType(&action{}), docCategories("droplet")) - AddStringFlag(cmdDropletActionRebuild, doctl.ArgImage, "", "Image ID or Slug", requiredOpt()) - AddBoolFlag(cmdDropletActionRebuild, doctl.ArgCommandWait, false, "Wait for action to complete") + AddStringFlag(cmdDropletActionRebuild, doctl.ArgImage, "", "", "Image ID or Slug", requiredOpt()) + AddBoolFlag(cmdDropletActionRebuild, doctl.ArgCommandWait, "", false, "Wait for action to complete") cmdDropletActionRename := CmdBuilder(cmd, RunDropletActionRename, "rename ", "rename droplet", Writer, displayerType(&action{}), docCategories("droplet")) - AddStringFlag(cmdDropletActionRename, doctl.ArgDropletName, "", "Droplet name", requiredOpt()) - AddBoolFlag(cmdDropletActionRename, doctl.ArgCommandWait, false, "Wait for action to complete") + AddStringFlag(cmdDropletActionRename, doctl.ArgDropletName, "", "", "Droplet name", requiredOpt()) + AddBoolFlag(cmdDropletActionRename, doctl.ArgCommandWait, "", false, "Wait for action to complete") cmdDropletActionChangeKernel := CmdBuilder(cmd, RunDropletActionChangeKernel, "change-kernel ", "change kernel", Writer, displayerType(&action{}), docCategories("droplet")) - AddIntFlag(cmdDropletActionChangeKernel, doctl.ArgKernelID, 0, "Kernel ID", requiredOpt()) - AddBoolFlag(cmdDropletActionChangeKernel, doctl.ArgCommandWait, false, "Wait for action to complete") + AddIntFlag(cmdDropletActionChangeKernel, doctl.ArgKernelID, "", 0, "Kernel ID", requiredOpt()) + AddBoolFlag(cmdDropletActionChangeKernel, doctl.ArgCommandWait, "", false, "Wait for action to complete") cmdDropletActionSnapshot := CmdBuilder(cmd, RunDropletActionSnapshot, "snapshot ", "snapshot droplet", Writer, displayerType(&action{}), docCategories("droplet")) - AddStringFlag(cmdDropletActionSnapshot, doctl.ArgSnapshotName, "", "Snapshot name", requiredOpt()) - AddBoolFlag(cmdDropletActionSnapshot, doctl.ArgCommandWait, false, "Wait for action to complete") + AddStringFlag(cmdDropletActionSnapshot, doctl.ArgSnapshotName, "", "", "Snapshot name", requiredOpt()) + AddBoolFlag(cmdDropletActionSnapshot, doctl.ArgCommandWait, "", false, "Wait for action to complete") return cmd } diff --git a/commands/droplets.go b/commands/droplets.go index 988364385..bed82b410 100644 --- a/commands/droplets.go +++ b/commands/droplets.go @@ -15,12 +15,12 @@ package commands import ( "fmt" - "text/template" "io/ioutil" "sort" "strconv" "strings" "sync" + "text/template" "github.com/digitalocean/doctl" "github.com/digitalocean/doctl/do" @@ -51,40 +51,40 @@ func Droplet() *Command { cmdDropletCreate := CmdBuilder(cmd, RunDropletCreate, "create NAME [NAME ...]", "create droplet", Writer, aliasOpt("c"), displayerType(&droplet{}), docCategories("droplet")) - AddStringSliceFlag(cmdDropletCreate, doctl.ArgSSHKeys, []string{}, "SSH Keys or fingerprints") - AddStringFlag(cmdDropletCreate, doctl.ArgUserData, "", "User data") - AddStringFlag(cmdDropletCreate, doctl.ArgUserDataFile, "", "User data file") - AddBoolFlag(cmdDropletCreate, doctl.ArgCommandWait, false, "Wait for droplet to be created") - AddStringFlag(cmdDropletCreate, doctl.ArgRegionSlug, "", "Droplet region", + AddStringSliceFlag(cmdDropletCreate, doctl.ArgSSHKeys, "", []string{}, "SSH Keys or fingerprints") + AddStringFlag(cmdDropletCreate, doctl.ArgUserData, "", "", "User data") + AddStringFlag(cmdDropletCreate, doctl.ArgUserDataFile, "", "", "User data file") + AddBoolFlag(cmdDropletCreate, doctl.ArgCommandWait, "", false, "Wait for droplet to be created") + AddStringFlag(cmdDropletCreate, doctl.ArgRegionSlug, "", "", "Droplet region", requiredOpt()) - AddStringFlag(cmdDropletCreate, doctl.ArgSizeSlug, "", "Droplet size", + AddStringFlag(cmdDropletCreate, doctl.ArgSizeSlug, "", "", "Droplet size", requiredOpt()) - AddBoolFlag(cmdDropletCreate, doctl.ArgBackups, false, "Backup droplet") - AddBoolFlag(cmdDropletCreate, doctl.ArgIPv6, false, "IPv6 support") - AddBoolFlag(cmdDropletCreate, doctl.ArgPrivateNetworking, false, "Private networking") - AddBoolFlag(cmdDropletCreate, doctl.ArgMonitoring, false, "Monitoring") - AddStringFlag(cmdDropletCreate, doctl.ArgImage, "", "Droplet image", + AddBoolFlag(cmdDropletCreate, doctl.ArgBackups, "", false, "Backup droplet") + AddBoolFlag(cmdDropletCreate, doctl.ArgIPv6, "", false, "IPv6 support") + AddBoolFlag(cmdDropletCreate, doctl.ArgPrivateNetworking, "", false, "Private networking") + AddBoolFlag(cmdDropletCreate, doctl.ArgMonitoring, "", false, "Monitoring") + AddStringFlag(cmdDropletCreate, doctl.ArgImage, "", "", "Droplet image", requiredOpt()) - AddStringFlag(cmdDropletCreate, doctl.ArgTagName, "", "Tag name") - AddStringSliceFlag(cmdDropletCreate, doctl.ArgTagNames, []string{}, "Tag names") + AddStringFlag(cmdDropletCreate, doctl.ArgTagName, "", "", "Tag name") + AddStringSliceFlag(cmdDropletCreate, doctl.ArgTagNames, "", []string{}, "Tag names") - AddStringSliceFlag(cmdDropletCreate, doctl.ArgVolumeList, []string{}, "Volumes to attach") + AddStringSliceFlag(cmdDropletCreate, doctl.ArgVolumeList, "", []string{}, "Volumes to attach") cmdRunDropletDelete := CmdBuilder(cmd, RunDropletDelete, "delete ID [ID|Name ...]", "Delete droplet by id or name", Writer, aliasOpt("d", "del", "rm"), docCategories("droplet")) - AddBoolFlag(cmdRunDropletDelete, doctl.ArgDeleteForce, false, "Force droplet delete") + AddBoolFlag(cmdRunDropletDelete, doctl.ArgDeleteForce, doctl.ArgShortDeleteForce, false, "Force droplet delete") cmdRunDropletGet := CmdBuilder(cmd, RunDropletGet, "get", "get droplet", Writer, aliasOpt("g"), displayerType(&droplet{}), docCategories("droplet")) - AddStringFlag(cmdRunDropletGet, doctl.ArgTemplate, "", "Go template format. Few sample values:{{.ID}} {{.Name}} {{.Memory}} {{.Region.Name}} {{.Image}} {{.Tags}}") + AddStringFlag(cmdRunDropletGet, doctl.ArgTemplate, "", "", "Go template format. Few sample values:{{.ID}} {{.Name}} {{.Memory}} {{.Region.Name}} {{.Image}} {{.Tags}}") CmdBuilder(cmd, RunDropletKernels, "kernels ", "droplet kernels", Writer, aliasOpt("k"), displayerType(&kernel{}), docCategories("droplet")) cmdRunDropletList := CmdBuilder(cmd, RunDropletList, "list [GLOB]", "list droplets", Writer, aliasOpt("ls"), displayerType(&droplet{}), docCategories("droplet")) - AddStringFlag(cmdRunDropletList, doctl.ArgRegionSlug, "", "Droplet region") - AddStringFlag(cmdRunDropletList, doctl.ArgTagName, "", "Tag name") + AddStringFlag(cmdRunDropletList, doctl.ArgRegionSlug, "", "", "Droplet region") + AddStringFlag(cmdRunDropletList, doctl.ArgTagName, "", "", "Tag name") CmdBuilder(cmd, RunDropletNeighbors, "neighbors ", "droplet neighbors", Writer, aliasOpt("n"), displayerType(&droplet{}), docCategories("droplet")) @@ -94,12 +94,12 @@ func Droplet() *Command { cmdRunDropletTag := CmdBuilder(cmd, RunDropletTag, "tag ", "tag", Writer, docCategories("droplet")) - AddStringFlag(cmdRunDropletTag, doctl.ArgTagName, "", "Tag name", + AddStringFlag(cmdRunDropletTag, doctl.ArgTagName, "", "", "Tag name", requiredOpt()) cmdRunDropletUntag := CmdBuilder(cmd, RunDropletUntag, "untag ", "untag", Writer, docCategories("droplet")) - AddStringSliceFlag(cmdRunDropletUntag, doctl.ArgTagName, []string{}, "tag names") + AddStringSliceFlag(cmdRunDropletUntag, doctl.ArgTagName, "", []string{}, "tag names") return cmd } diff --git a/commands/floating_ips.go b/commands/floating_ips.go index 0f1e02505..6ca7eb467 100644 --- a/commands/floating_ips.go +++ b/commands/floating_ips.go @@ -38,10 +38,10 @@ func FloatingIP() *Command { cmdFloatingIPCreate := CmdBuilder(cmd, RunFloatingIPCreate, "create", "create a floating IP", Writer, aliasOpt("c"), displayerType(&floatingIP{}), docCategories("floatingip")) - AddStringFlag(cmdFloatingIPCreate, doctl.ArgRegionSlug, "", + AddStringFlag(cmdFloatingIPCreate, doctl.ArgRegionSlug, "", "", fmt.Sprintf("Region where to create the floating IP. (mutually exclusive with %s)", doctl.ArgDropletID)) - AddIntFlag(cmdFloatingIPCreate, doctl.ArgDropletID, 0, + AddIntFlag(cmdFloatingIPCreate, doctl.ArgDropletID, "", 0, fmt.Sprintf("ID of the droplet to assign the IP to. (mutually exclusive with %s)", doctl.ArgRegionSlug)) @@ -52,7 +52,7 @@ func FloatingIP() *Command { cmdFloatingIPList := CmdBuilder(cmd, RunFloatingIPList, "list", "list all floating IP addresses", Writer, aliasOpt("ls"), displayerType(&floatingIP{}), docCategories("floatingip")) - AddStringFlag(cmdFloatingIPList, doctl.ArgRegionSlug, "", "Floating IP region") + AddStringFlag(cmdFloatingIPList, doctl.ArgRegionSlug, "", "", "Floating IP region") return cmd } diff --git a/commands/image_actions.go b/commands/image_actions.go index 9b9970e0c..d6db77cce 100644 --- a/commands/image_actions.go +++ b/commands/image_actions.go @@ -36,13 +36,13 @@ func ImageAction() *Command { cmdImageActionsGet := CmdBuilder(cmd, RunImageActionsGet, "get ", "get image action", Writer, displayerType(&action{}), docCategories("image")) - AddIntFlag(cmdImageActionsGet, doctl.ArgActionID, 0, "action id", requiredOpt()) + AddIntFlag(cmdImageActionsGet, doctl.ArgActionID, "", 0, "action id", requiredOpt()) cmdImageActionsTransfer := CmdBuilder(cmd, RunImageActionsTransfer, "transfer ", "transfer image", Writer, displayerType(&action{}), docCategories("image")) - AddStringFlag(cmdImageActionsTransfer, doctl.ArgRegionSlug, "", "region", requiredOpt()) - AddBoolFlag(cmdImageActionsTransfer, doctl.ArgCommandWait, false, "Wait for action to complete") + AddStringFlag(cmdImageActionsTransfer, doctl.ArgRegionSlug, "", "", "region", requiredOpt()) + AddBoolFlag(cmdImageActionsTransfer, doctl.ArgCommandWait, "", false, "Wait for action to complete") return cmd } diff --git a/commands/images.go b/commands/images.go index 4ae329b5d..96f23b962 100644 --- a/commands/images.go +++ b/commands/images.go @@ -37,33 +37,33 @@ func Images() *Command { cmdImagesList := CmdBuilder(cmd, RunImagesList, "list", "list images", Writer, aliasOpt("ls"), displayerType(&image{}), docCategories("image")) - AddBoolFlag(cmdImagesList, doctl.ArgImagePublic, false, "List public images") + AddBoolFlag(cmdImagesList, doctl.ArgImagePublic, "", false, "List public images") cmdImagesListDistribution := CmdBuilder(cmd, RunImagesListDistribution, "list-distribution", "list distribution images", Writer, displayerType(&image{}), docCategories("image")) - AddBoolFlag(cmdImagesListDistribution, doctl.ArgImagePublic, false, "List public images") + AddBoolFlag(cmdImagesListDistribution, doctl.ArgImagePublic, "", false, "List public images") cmdImagesListApplication := CmdBuilder(cmd, RunImagesListApplication, "list-application", "list application images", Writer, displayerType(&image{}), docCategories("image")) - AddBoolFlag(cmdImagesListApplication, doctl.ArgImagePublic, false, "List public images") + AddBoolFlag(cmdImagesListApplication, doctl.ArgImagePublic, "", false, "List public images") cmdImagesListUser := CmdBuilder(cmd, RunImagesListUser, "list-user", "list user images", Writer, displayerType(&image{}), docCategories("image")) - AddBoolFlag(cmdImagesListUser, doctl.ArgImagePublic, false, "List public images") + AddBoolFlag(cmdImagesListUser, doctl.ArgImagePublic, "", false, "List public images") CmdBuilder(cmd, RunImagesGet, "get ", "Get image", Writer, displayerType(&image{}), docCategories("image")) cmdImagesUpdate := CmdBuilder(cmd, RunImagesUpdate, "update ", "Update image", Writer, displayerType(&image{}), docCategories("image")) - AddStringFlag(cmdImagesUpdate, doctl.ArgImageName, "", "Image name", requiredOpt()) + AddStringFlag(cmdImagesUpdate, doctl.ArgImageName, "", "", "Image name", requiredOpt()) cmdRunImagesDelete := CmdBuilder(cmd, RunImagesDelete, "delete ", "Delete image", Writer, docCategories("image")) - AddBoolFlag(cmdRunImagesDelete, doctl.ArgDeleteForce, false, "Force image delete") + AddBoolFlag(cmdRunImagesDelete, doctl.ArgDeleteForce, doctl.ArgShortDeleteForce, false, "Force image delete") return cmd } diff --git a/commands/snapshots.go b/commands/snapshots.go index 92fdae79b..40f8bdd77 100644 --- a/commands/snapshots.go +++ b/commands/snapshots.go @@ -36,15 +36,15 @@ func Snapshot() *Command { cmdRunSnapshotList := CmdBuilder(cmd, RunSnapshotList, "list [GLOB]", "list snapshots", Writer, aliasOpt("ls"), displayerType(&snapshot{}), docCategories("snapshot")) - AddStringFlag(cmdRunSnapshotList, doctl.ArgResourceType, "", "Resource type") - AddStringFlag(cmdRunSnapshotList, doctl.ArgRegionSlug, "", "Snapshot region") + AddStringFlag(cmdRunSnapshotList, doctl.ArgResourceType, "", "", "Resource type") + AddStringFlag(cmdRunSnapshotList, doctl.ArgRegionSlug, "", "", "Snapshot region") CmdBuilder(cmd, RunSnapshotGet, "get", "get snapshot", Writer, aliasOpt("g"), displayerType(&droplet{}), docCategories("snapshot")) cmdRunSnapshotDelete := CmdBuilder(cmd, RunSnapshotDelete, "delete", "delete snapshot", Writer, aliasOpt("d"), displayerType(&droplet{}), docCategories("snapshot")) - AddBoolFlag(cmdRunSnapshotDelete, doctl.ArgDeleteForce, false, "Force snapshot delete") + AddBoolFlag(cmdRunSnapshotDelete, doctl.ArgDeleteForce, doctl.ArgShortDeleteForce, false, "Force snapshot delete") return cmd } diff --git a/commands/ssh.go b/commands/ssh.go index 9743cf18a..dbf251046 100644 --- a/commands/ssh.go +++ b/commands/ssh.go @@ -39,11 +39,11 @@ func SSH(parent *Command) *Command { cmdSSH := CmdBuilder(parent, RunSSH, "ssh ", "ssh to droplet", Writer, docCategories("droplet")) - AddStringFlag(cmdSSH, doctl.ArgSSHUser, "root", "ssh user") - AddStringFlag(cmdSSH, doctl.ArgsSSHKeyPath, path, "path to private ssh key") - AddIntFlag(cmdSSH, doctl.ArgsSSHPort, 22, "port sshd is running on") - AddBoolFlag(cmdSSH, doctl.ArgsSSHAgentForwarding, false, "enable ssh agent forwarding") - AddBoolFlag(cmdSSH, doctl.ArgsSSHPrivateIP, false, "ssh to private ip instead of public ip") + AddStringFlag(cmdSSH, doctl.ArgSSHUser, "", "root", "ssh user") + AddStringFlag(cmdSSH, doctl.ArgsSSHKeyPath, "", path, "path to private ssh key") + AddIntFlag(cmdSSH, doctl.ArgsSSHPort, "", 22, "port sshd is running on") + AddBoolFlag(cmdSSH, doctl.ArgsSSHAgentForwarding, "", false, "enable ssh agent forwarding") + AddBoolFlag(cmdSSH, doctl.ArgsSSHPrivateIP, "", false, "ssh to private ip instead of public ip") return cmdSSH } diff --git a/commands/sshkeys.go b/commands/sshkeys.go index 5c4fff13e..e9ab81580 100644 --- a/commands/sshkeys.go +++ b/commands/sshkeys.go @@ -44,18 +44,18 @@ func SSHKeys() *Command { cmdSSHKeysCreate := CmdBuilder(cmd, RunKeyCreate, "create ", "create ssh key", Writer, aliasOpt("c"), displayerType(&key{}), docCategories("sshkeys")) - AddStringFlag(cmdSSHKeysCreate, doctl.ArgKeyPublicKey, "", "Key contents", requiredOpt()) + AddStringFlag(cmdSSHKeysCreate, doctl.ArgKeyPublicKey, "", "", "Key contents", requiredOpt()) cmdSSHKeysImport := CmdBuilder(cmd, RunKeyImport, "import ", "import ssh key", Writer, aliasOpt("i"), displayerType(&key{}), docCategories("sshkeys")) - AddStringFlag(cmdSSHKeysImport, doctl.ArgKeyPublicKeyFile, "", "Public key file", requiredOpt()) + AddStringFlag(cmdSSHKeysImport, doctl.ArgKeyPublicKeyFile, "", "", "Public key file", requiredOpt()) CmdBuilder(cmd, RunKeyDelete, "delete ", "delete ssh key", Writer, aliasOpt("d"), docCategories("sshkeys")) cmdSSHKeysUpdate := CmdBuilder(cmd, RunKeyUpdate, "update ", "update ssh key", Writer, aliasOpt("u"), displayerType(&key{}), docCategories("sshkeys")) - AddStringFlag(cmdSSHKeysUpdate, doctl.ArgKeyName, "", "Key name", requiredOpt()) + AddStringFlag(cmdSSHKeysUpdate, doctl.ArgKeyName, "", "", "Key name", requiredOpt()) return cmd } diff --git a/commands/tags.go b/commands/tags.go index 402ef5e9e..a6277229f 100644 --- a/commands/tags.go +++ b/commands/tags.go @@ -45,12 +45,12 @@ func Tags() *Command { cmdTagUpdate := CmdBuilder(cmd, RunCmdTagUpdate, "update NAME", "update tag", Writer, docCategories("tag")) - AddStringFlag(cmdTagUpdate, doctl.ArgTagName, "", "Tag name", + AddStringFlag(cmdTagUpdate, doctl.ArgTagName, "", "", "Tag name", requiredOpt()) cmdRunTagDelete := CmdBuilder(cmd, RunCmdTagDelete, "delete NAME", "delete tag", Writer, docCategories("tag")) - AddBoolFlag(cmdRunTagDelete, doctl.ArgDeleteForce, false, "Force tag delete") + AddBoolFlag(cmdRunTagDelete, doctl.ArgDeleteForce, doctl.ArgShortDeleteForce, false, "Force tag delete") return cmd } diff --git a/commands/volumes.go b/commands/volumes.go index 3cce8d346..fc0f8361a 100644 --- a/commands/volumes.go +++ b/commands/volumes.go @@ -23,15 +23,14 @@ func Volume() *Command { cmdRunVolumeList := CmdBuilder(cmd, RunVolumeList, "list", "list volume", Writer, aliasOpt("ls"), displayerType(&volume{})) - AddStringFlag(cmdRunVolumeList, doctl.ArgRegionSlug, "", "Volume region") + AddStringFlag(cmdRunVolumeList, doctl.ArgRegionSlug, "", "", "Volume region") cmdVolumeCreate := CmdBuilder(cmd, RunVolumeCreate, "create [name]", "create a volume", Writer, aliasOpt("c"), displayerType(&volume{})) - - AddStringFlag(cmdVolumeCreate, doctl.ArgVolumeSize, "4TiB", "Volume size", + AddStringFlag(cmdVolumeCreate, doctl.ArgVolumeSize, "", "4TiB", "Volume size", requiredOpt()) - AddStringFlag(cmdVolumeCreate, doctl.ArgVolumeDesc, "", "Volume description") - AddStringFlag(cmdVolumeCreate, doctl.ArgVolumeRegion, "", "Volume region", + AddStringFlag(cmdVolumeCreate, doctl.ArgVolumeDesc, "", "", "Volume description") + AddStringFlag(cmdVolumeCreate, doctl.ArgVolumeRegion, "", "", "Volume region", requiredOpt()) CmdBuilder(cmd, RunVolumeDelete, "delete [ID]", "delete a volume", Writer,