// SetFlags initializes the flags supported by the command.
495356
func (c *AddCloudCommand) SetFlags(f *gnuflag.FlagSet) {
	c.OptionalControllerCommand.SetFlags(f)
	f.BoolVar(&c.Replace, "replace", false, "Overwrite any existing cloud information for <cloud name>")
	f.StringVar(&c.CloudFile, "f", "", "The path to a cloud definition file")
	f.StringVar(&c.credentialName, "credential", "", "Credential to use for new cloud")
}
723807
func (c *listImagesCommand) SetFlags(f *gnuflag.FlagSet) {
	c.cloudImageMetadataCommandBase.SetFlags(f)

	f.StringVar(&c.Stream, "stream", "", "image metadata stream")
	f.StringVar(&c.Region, "region", "", "image metadata cloud region")

	f.Var(cmd.NewAppendStringsValue(&c.Series), "series", "only show cloud image metadata for these series")
	f.Var(cmd.NewAppendStringsValue(&c.Arches), "arch", "only show cloud image metadata for these architectures")

	f.StringVar(&c.VirtType, "virt-type", "", "image metadata virtualisation type")
	f.StringVar(&c.RootStorageType, "storage-type", "", "image metadata root storage type")

	c.out.AddFlags(f, "tabular", map[string]cmd.Formatter{
		"yaml":    cmd.FormatYaml,
		"json":    cmd.FormatJson,
		"tabular": formatMetadataListTabular,
	})
}
1330819
func (c *dumpCommand) SetFlags(f *gnuflag.FlagSet) {
	c.ModelCommandBase.SetFlags(f)
	c.out.AddFlags(f, "yaml", output.DefaultFormatters)
	f.BoolVar(&c.simplified, "simplified", false, "Dump a simplified partial model")
}
507167
func (c *trackBranchCommand) SetFlags(f *gnuflag.FlagSet) {
	c.ModelCommandBase.SetFlags(f)
}
106422
func (c *diffCommand) SetFlags(f *gnuflag.FlagSet) {
	c.ModelCommandBase.SetFlags(f)
	f.BoolVar(&c.isoTime, "utc", false, "Display time as UTC in RFC3339 format")
	f.BoolVar(&c.detailed, "all", false, "Show branch unit detail")
	c.out.AddFlags(f, "yaml", output.DefaultFormatters)
}
681547
func (c *deleteImageMetadataCommand) SetFlags(f *gnuflag.FlagSet) {
	c.cloudImageMetadataCommandBase.SetFlags(f)
}
476957
func (c *dumpLogsCommand) SetFlags(f *gnuflag.FlagSet) {
	c.agentConfig.AddFlags(f)
	f.StringVar(&c.outDir, "d", ".", "directory to write logs files to")
	f.StringVar(&c.outDir, "output-directory", ".", "")
	f.StringVar(&c.machineId, "machine-id", "", "id of the machine on this host (optional)")
}
444925
func (p *Parser) SetFlags(flags interface{}) {
	flagsElement := reflect.ValueOf(flags).Elem()
	flagsType := flagsElement.Type()
	for i := 0; i < flagsElement.NumField(); i++ {
		typeField := flagsType.Field(i)
		elementField := flagsElement.Field(i)
		var deletion string
		for k, v := range p.flags {
			if k == typeField.Tag.Get(v.kind) && elementField.CanSet() {
				var err error
				switch elementField.Kind() {
				case reflect.Bool:
					elementField.SetBool(true)
				case reflect.String:
					elementField.SetString(v.value)
				case reflect.Int64:
					i, e := strconv.ParseInt(v.value, 10, 64)
					if e == nil {
						elementField.SetInt(i)
					} else {
						err = e
					}
				case reflect.Uint64:
					u, e := strconv.ParseUint(v.value, 10, 64)
					if e == nil {
						elementField.SetUint(u)
					} else {
						err = e
					}
				case reflect.Float64:
					f, e := strconv.ParseFloat(v.value, 64)
					if e == nil {
						elementField.SetFloat(f)
					} else {
						err = e
					}
				default:
					panic("[cli-ng] Unsupported flag type: " + elementField.Kind().String())
				}
				if err != nil {
					panic("Failed to parse flag '" + k + "', reason: " + err.Error())
				}
				deletion = k
				break
			}
		}
		if deletion != "" {
			delete(p.flags, deletion)
		}
	}
}
389793
func (c *guiCommand) SetFlags(f *gnuflag.FlagSet) {
	c.ModelCommandBase.SetFlags(f)
	f.BoolVar(&c.hideCreds, "hide-credential", false, "Do not show admin credential to use for logging into the Juju GUI")
	f.BoolVar(&c.showCreds, "show-credentials", true, "DEPRECATED. Show admin credential to use for logging into the Juju GUI")
	f.BoolVar(&c.noBrowser, "no-browser", true, "DEPRECATED. --no-browser is now the default. Use --browser to open the web browser")
	f.BoolVar(&c.browser, "browser", false, "Open the web browser, instead of just printing the Juju GUI URL")
}
699311
func (c *CreateCommand) SetFlags(f *gnuflag.FlagSet) {
	c.SubnetCommandBase.SetFlags(f)
	f.BoolVar(&c.IsPublic, "public", false, "enable public access with shadow addresses")
	f.BoolVar(&c.IsPrivate, "private", true, "disable public access with shadow addresses")

	// Because SetFlags is called before Parse, we cannot
	// use f.Visit() here to check both flags were not
	// specified at once. So we store the flag set and
	// defer the check to Init().
	c.flagSet = f
}
1063900
func (r *RegisterMeteredCharm) SetFlags(f *gnuflag.FlagSet) {
	f.IntVar(&r.IncreaseBudget, "increase-budget", 0, "increase model budget allocation by this amount")
	f.StringVar(&r.Plan, "plan", "", "plan to deploy charm under")
}
121386
func (cmd *CLI) setFlag(flag *Flag, value string) error {
	_ = cmd.flags[flag.Name] // Verify the flag is a flag for f set
	err := flag.value.Set(value)
	if err != nil {
		return err
	}
	cmd.flagValues[flag] = flag.value
	return nil
}
781116
func (c *listCommand) SetFlags(f *gnuflag.FlagSet) {
	c.StorageCommandBase.SetFlags(f)
	c.out.AddFlags(f, "tabular", map[string]cmd.Formatter{
		"yaml":    cmd.FormatYaml,
		"json":    cmd.FormatJson,
		"tabular": formatListTabularOne,
	})
	// TODO(axw) deprecate these flags, and introduce separate commands
	// for listing just filesystems or volumes.
	f.BoolVar(&c.filesystem, "filesystem", false, "List filesystem storage")
	f.BoolVar(&c.volume, "volume", false, "List volume storage")
}
323634
func (op *CaasOperatorAgent) SetFlags(f *gnuflag.FlagSet) {
	op.AgentConf.AddFlags(f)
	f.StringVar(&op.ApplicationName, "application-name", "", "name of the application")
}
1082907
func (c *runCommand) SetFlags(f *gnuflag.FlagSet) {
	c.ActionCommandBase.SetFlags(f)
	c.out.AddFlags(f, "yaml", output.DefaultFormatters)
	f.Var(&c.paramsYAML, "params", "Path to yaml-formatted params file")
	f.BoolVar(&c.parseStrings, "string-args", false, "Use raw string values of CLI args")
	f.Var(&c.wait, "wait", "Wait for results, with optional timeout")
}
382576
func (c *listCommand) SetFlags(f *gnuflag.FlagSet) {
	c.CachedImagesCommandBase.SetFlags(f)
	f.StringVar(&c.Kind, "kind", "", "The image kind to list eg lxd")
	f.StringVar(&c.Series, "series", "", "The series of the image to list eg xenial")
	f.StringVar(&c.Arch, "arch", "", "The architecture of the image to list eg amd64")
	c.out.AddFlags(f, "yaml", output.DefaultFormatters)
}
6186
func (c *removeCommand) SetFlags(f *gnuflag.FlagSet) {
	c.ControllerCommandBase.SetFlags(f)
	f.BoolVar(&c.ConfirmDelete, "y", false, "Confirm deletion of the user")
	f.BoolVar(&c.ConfirmDelete, "yes", false, "")
}