// flag indicates whether or not the search is case sensitive.
767404
func (s *iniSection) getItem(key string, flag bool) *iniItem {
	if s == nil {
		return nil
	}
	key = ident(flag, key)

	for _, item := range s.Data {
		if item == nil {
			continue
		}
		if ident(flag, item.Key) == key {
			return item
		}
	}
	return nil
}
1019475
func sortFlags(flags map[string]*Flag) []*Flag {
	var list flagSlice

	// The sorted list is based on the first name, when flag map might use the other names.
	nameMap := make(map[string]string)

	for n, f := range flags {
		fName := strings.TrimPrefix(f.Names[0], "#")
		nameMap[fName] = n
		if len(f.Names) == 1 {
			list = append(list, fName)
			continue
		}

		found := false
		for _, name := range list {
			if name == fName {
				found = true
				break
			}
		}
		if !found {
			list = append(list, fName)
		}
	}
	sort.Sort(list)
	result := make([]*Flag, len(list))
	for i, name := range list {
		result[i] = flags[nameMap[name]]
	}
	return result
}
1124221
func FlagIt(v interface{}) (fs *flag.FlagSet) {
	val := reflect.ValueOf(v).Elem()
	structName := val.Type().Name()

	// Create FlagSet
	fs = flag.NewFlagSet(structName, flag.ContinueOnError)
	// for each field in struct
	for i := 0; i < val.NumField(); i++ {
		FlagByType(fs, structName, val.Field(i), val.Type().Field(i))
	}
	return fs
}
380940
func NewFlagCheckOption(flag bool) Option {
	return &option{optionType: flagCheckOption, value: NewFlagCheckFilter(flag)}
}
717700
func (q RegexpQuery) Flags(flags string) RegexpQuery {
	q.flags = &flags
	return q
}
140017
func Flags(f byte) Field {
	return func(p *Packet) error {
		return p.append(flags, []byte{f})
	}
}
238924
func (f Flag) String(name string) (string, error) {
	return f.value(name)
}
138846
func validFlags(flags net.Flags) error {
	if (flags & syscall.IFF_UP) != syscall.IFF_UP {
		return fmt.Errorf("Unsupported network flags specified: %v", flags)
	}

	return nil
}
808700
func (cl *CommandLine) RemoveAllFlag(flag string) (found bool) {
	return cl.RemoveFlagMatch(func(f CommandLineFlag) bool { return f.Flag == flag })
}
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
}
1257294
func (app *App) GetStringFlag(name string) (string, bool) {
	if !flag.Parsed() && !flagsDisabled {
		flag.Parse()
	}
	if app.Flags.values != nil {
		if bindFlag, ok := app.Flags.values[name]; ok {
			return *bindFlag.Value, ok
		}
	}

	return "", false
}
1166421
func (c Flags) Validate() error {
	var notFilled []string
	for _, v := range c {
		// if no value given (nil) for required flag then it is not valid
		isRequired := v.Default == nil
		val := reflect.ValueOf(v.Value).Elem().String()
		if isRequired && val == "" {
			notFilled = append(notFilled, v.Name)
		}
	}

	if len(notFilled) > 0 {
		if len(notFilled) == 1 {
			return errFlagMissing.Format(notFilled[0])
		}
		return errFlagMissing.Format(strings.Join(notFilled, ","))

	}
	return nil

}
632893
func Flag(v interface{}, short rune, helpvalue ...string) Option {
	return CommandLine.long(v, "", short, helpvalue...)
}
692289
func (f Flag) String() string {
	switch f {
	case ExitSettle:
		return "ExitSettle"
	case AddIncoming:
		return "AddIncoming"
	case SettleIncoming:
		return "SettleIncoming"
	case FailIncoming:
		return "FailIncoming"
	case AddOutgoing:
		return "AddOutgoing"
	case SettleOutgoing:
		return "SettleOutgoing"
	case FailOutgoing:
		return "FailOutgoing"
	case Commit:
		return "Commit"
	case BogusSettle:
		return "BogusSettle"
	default:
		return "UnknownHodlFlag"
	}
}
181811
func (m *Message) Flag(flag string) bool {
	if len(m.Attributes) > 0 {
		return m.Attributes.Flag(flag)
	}
	return false
}
252466
func WithoutFlag(args []string, flag string) []string {
	out := make([]string, 0, len(args))
	for i := 0; i < len(args); i += 1 {
		val := args[i]
		if !strings.HasPrefix(val, flag) {
			out = append(out, val)
		} else {
			if !strings.Contains(val, "=") && i+1 <= len(args)-1 {
				i += 1
			}
		}
	}
	return out
}
56180
func (m *HeaderCtxFlag) FlagStr() string {
	m.mu.RLock()
	ret := m.expectedVal
	m.mu.RUnlock()
	return ret
}