// NewFlag returns a new instance of the Flag Checker, using os.Args as its
// flag source.
765962
func NewFlag() *Flag {
	f := &Flag{
		args:     os.Args,
		defaults: defaultsPrinter,
	}

	return f
}
563066
func NewIntSliceFlag(fl cli.IntSliceFlag) *IntSliceFlag {
	return &IntSliceFlag{IntSliceFlag: fl, set: nil}
}
380940
func NewFlagCheckOption(flag bool) Option {
	return &option{optionType: flagCheckOption, value: NewFlagCheckFilter(flag)}
}
654191
func Flag(name string, defv interface{}, usage string) V {
	return flagA(flagT{
		name:  name,
		defv:  defv,
		usage: usage,
	})
}
1158238
func NewFlagSet(name string, errorHandling ErrorHandling) *FlagSet {
	f := &FlagSet{
		name:          name,
		errorHandling: errorHandling,
	}
	return f
}
367233
func (cmd *CLI) AliasFlag(alias rune, flagname string) {
	flag, ok := cmd.flags[flagname]
	if !ok {
		panic(fmt.Sprintf("flag not defined %v", flagname))
	}
	if cmd.aliases == nil {
		cmd.aliases = make(map[rune]*Flag)
	}
	cmd.aliases[alias] = flag
}
296223
func (f VerifyFlag) AddFlag(fset *pflag.FlagSet) (interface{}, error) {
	switch f.Type {
	case StringFlag:
		return fset.String(f.Name, "", f.Description), nil
	case BoolFlag:
		return fset.Bool(f.Name, false, f.Description), nil
	default:
		return nil, errors.Errorf("unrecognized flag type: %v", f.Type)
	}
}
964677
func NewDBFlagSet() *pflag.FlagSet {
	flags := &pflag.FlagSet{}

	// db subsection flags
	flags.BoolP("db.debug-mode", "", false, "Output database model SQL queries")
	flags.StringP("db.db", "", "", "The database software (postgres|mysql)")
	flags.StringP("db.dbname", "", "", "The database name to connect to")
	flags.StringP("db.host", "", "", "The database hostname, e.g localhost")
	flags.IntP("db.port", "", 0, "The database port")
	flags.StringP("db.user", "", "", "The database username")
	flags.StringP("db.pass", "", "", "The database password")
	flags.StringP("db.sslmode", "", "", "The database sslmode")
	flags.BoolP("db.enforce-migrations", "", true, "Throw error on app start if database is not using latest migration")

	return flags
}
907833
func (bto *BootstrapTokenOptions) AddTokenFlag(fs *pflag.FlagSet) {
	fs.StringVar(
		&bto.TokenStr, TokenStr, "",
		"The token to use for establishing bidirectional trust between nodes and control-plane nodes. The format is [a-z0-9]{6}\\.[a-z0-9]{16} - e.g. abcdef.0123456789abcdef",
	)
}
216062
func (f *FlagSets) NewFlagSet(name string) *FlagSet {
	flagSet := NewFlagSet(name)
	flagSet.mainSet = f.mainSet
	flagSet.completions = f.completions
	f.flagSets = append(f.flagSets, flagSet)
	return flagSet
}
690201
func (f *CLI) AddFlags(flags *flag.FlagSet) {
	if flags == nil {
		flags = flag.CommandLine
	}

	if f.InstallName == "" {
		f.InstallName = defaultInstallName
	}
	if f.UninstallName == "" {
		f.UninstallName = defaultUninstallName
	}

	if flags.Lookup(f.InstallName) == nil {
		flags.BoolVar(&f.install, f.InstallName, false,
			fmt.Sprintf("Install completion for %s command", f.Name))
	}
	if flags.Lookup(f.UninstallName) == nil {
		flags.BoolVar(&f.uninstall, f.UninstallName, false,
			fmt.Sprintf("Uninstall completion for %s command", f.Name))
	}
	if flags.Lookup("y") == nil {
		flags.BoolVar(&f.yes, "y", false, "Don't prompt user for typing 'yes' when installing completion")
	}
}
504465
func NewRootFlagSet() *pflag.FlagSet {
	flags := &pflag.FlagSet{}

	// root level flags
	flags.BoolP("version", "", false, "Display the build version hash")
	flags.StringP("env", "e", "prod", "The config files environment to load")

	return flags
}
1005435
func NewStringFlag(fl cli.StringFlag) *StringFlag {
	return &StringFlag{StringFlag: fl, set: nil}
}
585364
func (env *Env) CopyFlag(path string, flags uint) error {
	cpath := C.CString(path)
	defer C.free(unsafe.Pointer(cpath))
	ret := C.mdb_env_copy2(env._env, cpath, C.uint(flags))
	return operrno("mdb_env_copy2", ret)
}
1170114
func newFakeFlagSet(fs *pflag.FlagSet) *pflag.FlagSet {
	ret := pflag.NewFlagSet("", pflag.ExitOnError)
	ret.SetNormalizeFunc(fs.GetNormalizeFunc())
	fs.VisitAll(func(f *pflag.Flag) {
		ret.VarP(cliflag.NoOp{}, f.Name, f.Shorthand, f.Usage)
	})
	return ret
}
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
}
773119
func NewJSONSourceFromFlagFunc(flag string) func(c *cli.Context) (InputSourceContext, error) {
	return func(context *cli.Context) (InputSourceContext, error) {
		return NewJSONSourceFromFile(context.String(flag))
	}
}