Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &command.Command{ Cobra: &cobra.Command{ Use: "instances", Aliases: []string{"instance", "vms", "machines"}, Short: "Instances (aka VMs/Machines/Containers)", }, Setup: func(parent *command.Command) error { cmds := []*command.Command{ list.Cmd, create.Cmd, delete.Cmd, get.Cmd, count.Cmd, reboot.Cmd, start.Cmd, stop.Cmd, ip.Cmd, } for _, cmd := range cmds { cmd.Setup(cmd) parent.Cobra.AddCommand(cmd.Cobra) } { const ( key = config.KeyInstanceID longName = "id" defaultValue = "" description = "Instance ID" ) flags := parent.Cobra.PersistentFlags() flags.String(longName, defaultValue, description) viper.BindPFlag(key, flags.Lookup(longName)) } { const ( key = config.KeyInstanceName longName = "name" shortName = "n" defaultValue = "" description = "Instance Name" ) flags := parent.Cobra.PersistentFlags() flags.StringP(longName, shortName, defaultValue, description) viper.BindPFlag(key, flags.Lookup(longName)) } { const ( key = config.KeyInstanceTag longName = "tag" shortName = "t" description = "Instance Tags. This flag can be used multiple times" ) flags := parent.Cobra.PersistentFlags() flags.StringSliceP(longName, shortName, nil, description) viper.BindPFlag(key, flags.Lookup(longName)) } { flags := parent.Cobra.PersistentFlags() flags.SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName { switch name { case "tag": name = "tags" break } return pflag.NormalizedName(name) }) } { const ( key = config.KeyInstanceState longName = "state" defaultValue = "" description = "Instance state (e.g. running)" ) flags := parent.Cobra.PersistentFlags() flags.String(longName, defaultValue, description) viper.BindPFlag(key, flags.Lookup(longName)) } { const ( key = config.KeyInstanceBrand longName = "brand" defaultValue = "" description = "Instance brand (e.g. lx, kvm)" ) flags := parent.Cobra.PersistentFlags() flags.String(longName, defaultValue, description) viper.BindPFlag(key, flags.Lookup(longName)) } return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.