// NewTxValidationFlagsSetValue Creates new object-array of validation codes with target size
// and the supplied value
508547
func NewTxValidationFlagsSetValue(size int, value peer.TxValidationCode) TxValidationFlags {
	return newTxValidationFlagsSetValue(size, value)
}
36175
func (l *Logger) SetFlags(flag int) {
	l.Logger.SetFlags(flag)

	// Only proceed if we've actually got a prefix
	if l.Prefix() == "" {
		return
	}

	const clnSpc = ": "
	if flag&(log.Lshortfile|log.Llongfile) != 0 {
		l.SetPrefix(strings.TrimSuffix(l.Prefix(), clnSpc))
	} else {
		l.SetPrefix(l.Prefix() + clnSpc)
	}
}
381104
func (s *AlgorithmStatusDetails) SetValidationStatuses(v []*AlgorithmStatusItem) *AlgorithmStatusDetails {
	s.ValidationStatuses = v
	return s
}
1218430
func (m *HeaderCtxFlag) SetFlagStr(headerVal string) {
	m.mu.Lock()
	m.expectedVal = headerVal
	m.mu.Unlock()
}
590459
func (c *listCommand) SetFlags(f *gnuflag.FlagSet) {
	c.ModelCommandBase.SetFlags(f)
	f.StringVar(&c.applicationName, "application", "", "return results matching the application")
	f.StringVar(&c.interfaceName, "interface", "", "return results matching the interface name")
	f.StringVar(&c.consumerName, "allowed-consumer", "", "return results where the user is allowed to consume the offer")
	f.StringVar(&c.connectedUserName, "connected-user", "", "return results where the user has a connection to the offer")
	f.BoolVar(&c.activeOnly, "active-only", false, "only return results where the offer is in use")
	c.out.AddFlags(f, "tabular", map[string]cmd.Formatter{
		"yaml":    cmd.FormatYaml,
		"json":    cmd.FormatJson,
		"tabular": formatListTabular,
		"summary": formatListSummary,
	})
}
1296322
func (c *commitCommand) SetFlags(f *gnuflag.FlagSet) {
	c.ModelCommandBase.SetFlags(f)
}
663637
func (c *listControllersCommand) SetFlags(f *gnuflag.FlagSet) {
	c.CommandBase.SetFlags(f)
	f.BoolVar(&c.refresh, "refresh", false, "Connect to each controller to download the latest details")
	c.out.AddFlags(f, "tabular", map[string]cmd.Formatter{
		"yaml":    cmd.FormatYaml,
		"json":    cmd.FormatJson,
		"tabular": c.formatControllersListTabular,
	})
}
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)
}
708277
func (c *trustCommand) SetFlags(f *gnuflag.FlagSet) {
	c.ModelCommandBase.SetFlags(f)
	f.BoolVar(&c.removeTrust, "remove", false, "Remove trusted access from a trusted application")
}
46698
func ParseTagValue(v string) TagValue {
	ret := &bytes.Buffer{}

	input := bytes.NewBufferString(v)

	for {
		c, _, err := input.ReadRune()
		if err != nil {
			break
		}

		if c == '\\' {
			c2, _, err := input.ReadRune()

			// If we got a backslash then the end of the tag value, we should
			// just ignore the backslash.
			if err != nil {
				break
			}

			if replacement, ok := tagDecodeSlashMap[c2]; ok {
				ret.WriteRune(replacement)
			} else {
				ret.WriteRune(c2)
			}
		} else {
			ret.WriteRune(c)
		}
	}

	return TagValue(ret.String())
}
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")
}
129288
func validateValue(val string) error {
	// Values may be no more than 1024 bytes long.
	if len(val) > 1024 {
		return fmt.Errorf("Longer than 1024 bytes.")
	}

	// Values must be valid UTF-8.
	if !utf8.ValidString(val) {
		return fmt.Errorf("Not valid UTF-8.")
	}

	// Each codepoint in the string must be legal in an XML 1.0 document.
	for _, r := range val {
		if !isLegalXmlCharacter(r) {
			return fmt.Errorf("Invalid codepoint for XML 1.0 document: %U", r)
		}
	}

	return nil
}
1101325
func (v *flagValidator) validateNextFlag() (bool, error) {
	if len(v.args) == 0 {
		return false, nil
	}
	s := v.args[0]
	if len(s) < 2 || s[0] != '-' {
		return false, fmt.Errorf("invalid flag: %s", s)
	}
	numMinuses := 1
	if s[1] == '-' {
		numMinuses++
		if len(s) == 2 { // "--" terminates the flags
			v.args = v.args[1:]
			return false, errors.New("'--' flag with no name is not allowed")
		}
	}
	name := s[numMinuses:]
	if len(name) == 0 || name[0] == '-' || name[0] == '=' {
		return false, fmt.Errorf("bad flag syntax: %s", s)
	}

	// it's a flag. does it have an argument?
	v.args = v.args[1:]
	hasValue := false
	value := ""
	for i := 1; i < len(name); i++ { // equals cannot be first
		if name[i] == '=' {
			value = name[i+1:]
			hasValue = true
			name = name[0:i]
			break
		}
	}

	flag := v.flagset.Lookup(name)
	if flag == nil {
		return false, fmt.Errorf("undefined flag: -%s", name)
	}

	if fv, ok := flag.Value.(boolFlag); ok && fv.IsBoolFlag() { // special case: doesn't need an arg
		if len(v.args) > 0 {
			nextArg := v.args[0]
			if nextArg[0] != '-' {
				return false, fmt.Errorf("invalid value following flag -%s: %q; boolean flags must be passed as -flag=x", name, nextArg)
			}
		}
	} else {
		// It must have a value, which might be the next argument.
		if !hasValue && len(v.args) > 0 {
			// value is the next arg
			hasValue = true
			value, v.args = v.args[0], v.args[1:]
		}
		if !hasValue {
			return false, fmt.Errorf("flag needs an argument: -%s", name)
		}
	}
	_ = value
	return true, nil
}
1360388
func (c *CommandBase) SetFlags(f *gnuflag.FlagSet) {
	c.authOpts.SetFlags(f)
}
865482
func (c *bundleDiffCommand) SetFlags(f *gnuflag.FlagSet) {
	c.ModelCommandBase.SetFlags(f)
	f.StringVar((*string)(&c.channel), "channel", "", "Channel to use when getting the bundle from the charm store")
	f.Var(cmd.NewAppendStringsValue(&c.bundleOverlays), "overlay", "Bundles to overlay on the primary bundle, applied in order")
	f.StringVar(&c.machineMap, "map-machines", "", "Indicates how existing machines correspond to bundle machines")
	f.BoolVar(&c.annotations, "annotations", false, "Include differences in annotations")
}
486207
func (c *setFirewallRuleCommand) SetFlags(f *gnuflag.FlagSet) {
	f.StringVar(&c.whitelistValue, "whitelist", "", "list of subnets to whitelist")
}
1239638
func (c *ListPlansCommand) SetFlags(f *gnuflag.FlagSet) {
	c.CommandBase.SetFlags(f)
	defaultFormat := "tabular"
	c.out.AddFlags(f, defaultFormat, map[string]cmd.Formatter{
		"yaml":    cmd.FormatYaml,
		"json":    cmd.FormatJson,
		"smart":   cmd.FormatSmart,
		"summary": formatSummary,
		"tabular": formatTabular,
	})
}