// flag indicates whether or not the search is case sensitive.
164870
func (s *iniSection) get(key string, flag bool) *string {
	if item := s.getItem(key, flag); item != nil {
		return &item.Value
	}
	return nil
}
85090
func (f SelectFlag) String() string {
	var flags [2]string
	var n int
	if f&SelectCopy != 0 {
		flags[n] = "copy"
		n++
	}
	if f&SelectUnique != 0 {
		flags[n] = "unique"
		n++
	}
	return "[" + strings.Join(flags[:n], "|") + "]"
}
1183133
func flagName(field reflect.StructField) (flagname string) {
	var ok bool
	if flagname, ok = field.Tag.Lookup("flag"); ok {
		return flagname
	}

	if flagname, ok = field.Tag.Lookup("json"); ok {
		return flagname
	}
	flagname = field.Name

	return downcaseAndDash(flagname)
}
1010742
func nextFlag(index int, input []rune) (newIndex int, f Flag, err error) {
	var escaped, ok bool
	var r rune

	f = FlagNone

	newIndex, r, escaped, err = nextRune(index, input)
	if err != nil {
		return
	}

	if !escaped {
		// Revert back to index for later consumption.
		if f, ok = flagRunes[r]; !ok {
			newIndex = index
		}
	} else {
		// Revert back to index for later consumption.
		newIndex = index
	}

	return
}
1318766
func (app *App) AddFlag(f Flag) {
	if app.flagsQueue == nil {
		app.flagsQueue = make([]Flag, 0)
	}
	app.flagsQueue = append(app.flagsQueue, f)
}
140017
func Flags(f byte) Field {
	return func(p *Packet) error {
		return p.append(flags, []byte{f})
	}
}
653184
func CaseInsensitiveContains(s, substr string) bool {
	s, substr = strings.ToLower(s), strings.ToLower(substr)
	return strings.Contains(s, substr)
}
918298
func (c *Command) Flags() *flag.FlagSet {
	if c.flags == nil {
		c.flags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
		if c.flagErrorBuf == nil {
			c.flagErrorBuf = new(bytes.Buffer)
		}
		c.flags.SetOutput(c.flagErrorBuf)
	}

	return c.flags
}
808700
func (cl *CommandLine) RemoveAllFlag(flag string) (found bool) {
	return cl.RemoveFlagMatch(func(f CommandLineFlag) bool { return f.Flag == 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)
	}
}
734070
func CaseInsensitive(tokens ...string) Option {
	return func(p *Parser) error {
		for _, token := range tokens {
			p.caseInsensitive[token] = true
		}
		return nil
	}
}
613735
func (c *EvalCommand) VisitAllFlags(fn func(*flag.Flag)) {
	c.flags.VisitAll(fn)
}
643076
func Vis(src string, flag VisFlag) (string, error) {
	if flag&visMask != flag {
		return "", fmt.Errorf("vis: flag %q contains unknown or unsupported flags", flag)
	}

	output := ""
	for _, ch := range []byte(src) {
		encodedCh, err := vis(ch, flag)
		if err != nil {
			return "", err
		}
		output += encodedCh
	}

	return output, nil
}
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
}
769909
func (*GoFlags) Int(o string, d int, c string) *int {
	return flag.Int(o, d, c)
}
613293
func flagTypeVal(a *design.AttributeDefinition, key string, field string) string {
	switch a.Type {
	case design.Integer:
		return `intFlagVal("` + key + `", ` + field + ")"
	case design.String:
		return `stringFlagVal("` + key + `", ` + field + ")"
	case design.Number, design.Boolean, design.UUID, design.DateTime, design.Any:
		return "%s"
	default:
		return "&" + field
	}
}
1356944
func (m *Meta) defaultFlagSet(n string) *flag.FlagSet {
	f := flag.NewFlagSet(n, flag.ContinueOnError)

	// Create an io.Writer that writes to our Ui properly for errors.
	// This is kind of a hack, but it does the job. Basically: create
	// a pipe, use a scanner to break it into lines, and output each line
	// to the UI. Do this forever.
	errR, errW := io.Pipe()
	errScanner := bufio.NewScanner(errR)
	go func() {
		// This only needs to be alive long enough to write the help info if
		// there is a flag error. Kill the scanner after a short duriation to
		// prevent these from accumulating during tests, and cluttering up the
		// stack traces.
		time.AfterFunc(2*time.Second, func() {
			errW.Close()
		})
		for errScanner.Scan() {
			m.Ui.Error(errScanner.Text())
		}
	}()
	f.SetOutput(errW)

	// Set the default Usage to empty
	f.Usage = func() {}

	return f
}