// Flag returns true if set.
181811
func (m *Message) Flag(flag string) bool {
	if len(m.Attributes) > 0 {
		return m.Attributes.Flag(flag)
	}
	return false
}
692170
func (c *Context) IsSet(name string) bool {
	if c.setFlags == nil {
		c.setFlags = make(map[string]bool)

		c.flagSet.Visit(func(f *flag.Flag) {
			c.setFlags[f.Name] = true
		})

		c.flagSet.VisitAll(func(f *flag.Flag) {
			if _, ok := c.setFlags[f.Name]; ok {
				return
			}
			c.setFlags[f.Name] = false
		})

		// XXX hack to support IsSet for flags with EnvVar
		//
		// There isn't an easy way to do this with the current implementation since
		// whether a flag was set via an environment variable is very difficult to
		// determine here. Instead, we intend to introduce a backwards incompatible
		// change in version 2 to add `IsSet` to the Flag interface to push the
		// responsibility closer to where the information required to determine
		// whether a flag is set by non-standard means such as environment
		// variables is available.
		//
		// See https://github.com/urfave/cli/issues/294 for additional discussion
		flags := c.Command.Flags
		if c.Command.Name == "" { // cannot == Command{} since it contains slice types
			if c.App != nil {
				flags = c.App.Flags
			}
		}
		for _, f := range flags {
			eachName(f.GetName(), func(name string) {
				if isSet, ok := c.setFlags[name]; isSet || !ok {
					return
				}

				val := reflect.ValueOf(f)
				if val.Kind() == reflect.Ptr {
					val = val.Elem()
				}

				filePathValue := val.FieldByName("FilePath")
				if filePathValue.IsValid() {
					eachName(filePathValue.String(), func(filePath string) {
						if _, err := os.Stat(filePath); err == nil {
							c.setFlags[name] = true
							return
						}
					})
				}

				envVarValue := val.FieldByName("EnvVar")
				if envVarValue.IsValid() {
					eachName(envVarValue.String(), func(envVar string) {
						envVar = strings.TrimSpace(envVar)
						if _, ok := syscall.Getenv(envVar); ok {
							c.setFlags[name] = true
							return
						}
					})
				}
			})
		}
	}

	return c.setFlags[name]
}
1217141
func (mapOp *MapOperation) SetFlag(key string, value bool) *MapOperation {
	if mapOp.removeFlags != nil {
		delete(mapOp.removeFlags, key)
	}
	if mapOp.flagsToSet == nil {
		mapOp.flagsToSet = make(map[string]bool)
	}
	mapOp.flagsToSet[key] = value
	return mapOp
}
395082
func (p SHA1DeprecationPolicy) Flag(chain []*x509.Certificate) bool {
	leaf := chain[0]
	if time.Now().After(p.EffectiveDate) {

		// Reject newly issued leaf certificate with SHA-1 after the specified deadline.
		if !p.NeverIssueAfter.IsZero() && leaf.NotBefore.After(p.NeverIssueAfter) {
			// Check hash algorithm of non-root leaf cert.
			if len(chain) > 1 && helpers.HashAlgoString(leaf.SignatureAlgorithm) == "SHA1" {
				return true
			}
		}

		// Reject certificate chain with SHA-1 that are still valid after expiry deadline.
		if !p.ExpiryDeadline.IsZero() && leaf.NotAfter.After(p.ExpiryDeadline) {
			// Check hash algorithm of non-root certs.
			for i, cert := range chain {
				if i < len(chain)-1 {
					if helpers.HashAlgoString(cert.SignatureAlgorithm) == "SHA1" {
						return true
					}
				}
			}
		}
	}

	return false
}
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)
		}
	}
}
592055
func (p *ServerCmd) SetFlags(f *flag.FlagSet) {
	f.BoolVar(&p.debug, "debug", false, "debug mode (default: false)")
	f.BoolVar(&p.debugSQL, "debug-sql", false, "SQL debug mode (default: false)")
	f.BoolVar(&p.quiet, "quiet", false, "quiet mode (no output)")

	defaultLogDir := util.GetDefaultLogDir()
	f.StringVar(&p.logDir, "log-dir", defaultLogDir, "/path/to/log")
	f.BoolVar(&p.logJSON, "log-json", false, "output log as JSON")

	pwd := os.Getenv("PWD")
	f.StringVar(&p.dbpath, "dbpath", pwd+"/cve.sqlite3",
		"/path/to/sqlite3 or SQL connection string")

	f.StringVar(&p.dbtype, "dbtype", "sqlite3",
		"Database type to store data in (sqlite3, mysql, postgres or redis supported)")

	f.StringVar(&p.bind,
		"bind",
		"127.0.0.1",
		"HTTP server bind to IP address (default: loop back interface)")
	f.StringVar(&p.port, "port", "1323",
		"HTTP server port number (default: 1323)")
}
962119
func (s *scene) Flag(topic string) error {
	command := &envelope{
		kind: flag,
		signaling: &signaling{
			topic: topic,
		},
		respChan: make(chan *envelope, 1),
	}
	_, err := s.command(command)
	return err
}
842387
func (env *Env) Flags() (uint, error) {
	var _flags C.uint
	ret := C.mdb_env_get_flags(env._env, &_flags)
	if ret != success {
		return 0, operrno("mdb_env_get_flags", ret)
	}
	return uint(_flags), nil
}
1124445
func (f *FlagSet) Has(p FlagSet) bool {
	if *f&p != 0 {
		return true
	}
	return false
}
296256
func (a *App) Flag(name string, defaultValue interface{}, usage string) *App {
	if a.Flags == nil {
		a.Flags = Flags{}
	}

	a.Flags = append(a.Flags, &Flag{name, defaultValue, usage, nil, nil})
	return a
}
97846
func ActiveFlags() (ret []Flag) {
	ret = make([]Flag, 0, 1)
	for f := range flags {
		if f.IsSet() {
			ret = append(ret, f)
		}
	}
	return
}
688917
func (bf *SyncFlag) Set() {
	bf.Lock()
	atomic.StoreInt32(&bf.flag, 1)
	bf.Unlock()
}
421329
func (vm *Engine) hasFlag(flag ScriptFlags) bool {
	return vm.flags&flag == flag
}
654191
func Flag(name string, defv interface{}, usage string) V {
	return flagA(flagT{
		name:  name,
		defv:  defv,
		usage: usage,
	})
}
219833
func (cmd *CLI) Flags() values.Map {
	flags := make(values.Map)
	for name := range cmd.inheritedFlags.Merge(cmd.flags) {
		flags[name] = cmd.Flag(name)
	}
	return flags
}
387511
func checkFlags(c *cli.Context, flags ...string) error {
	for _, flag := range flags {
		if c.String(flag) == "" {
			cli.ShowSubcommandHelp(c)
			err := errors.Errorf("error: the required flag %q was empty or not provided", flag)
			fmt.Fprintln(os.Stderr, err)
			return err
		}
	}

	return nil
}
561704
func (fs *FlagSet) Set(name, value string) error {
	flag, ok := fs.formal[name]
	if !ok {
		return fmt.Errorf("no such flag -%v", name)
	}
	if err := flag.Value.Set(value); err != nil {
		return err
	}
	if fs.actual == nil {
		fs.actual = make(map[string]*Flag)
	}
	fs.actual[name] = flag
	return nil
}