// flag indicates whether or not the search is case sensitive.
510369
func (s *iniSection) rmItem(key string, flag bool) bool {
	if s == nil {
		return false
	}
	key = ident(flag, key)
	for i, item := range s.Data {
		if item == nil {
			continue
		}
		if ident(flag, item.Key) == key {
			n := len(s.Data) - 1
			skip := 1
			// Remove newline if the key was the last one in the block.
			if (i > 0 && s.Data[i-1] == nil && i < n && s.Data[i+1] == nil) ||
				(i == 0 && n > 0 && s.Data[1] == nil) {
				// Removed key is not the first key and previous and next keys are newlines.
				// Removed key is the first key and next key is a newline.
				skip++
				n--
			}
			copy(s.Data[i:], s.Data[i+skip:])
			s.Data[n] = nil
			s.Data = s.Data[:n]
			return true
		}
	}
	return false
}
380940
func NewFlagCheckOption(flag bool) Option {
	return &option{optionType: flagCheckOption, value: NewFlagCheckFilter(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
}
616647
func StatusFlag(status *pb.Status) flag.Getter {
	if status == nil {
		panic("status is nil")
	}
	return &statusFlag{status}
}
1052136
func (f Flag) Warning() string {
	var msg string
	switch f {
	case ExitSettle:
		msg = "will not attempt to settle ADD with sender"
	case AddIncoming:
		msg = "will not attempt to forward ADD to switch"
	case SettleIncoming:
		msg = "will not attempt to forward SETTLE to switch"
	case FailIncoming:
		msg = "will not attempt to forward FAIL to switch"
	case AddOutgoing:
		msg = "will not update channel state with downstream ADD"
	case SettleOutgoing:
		msg = "will not update channel state with downstream SETTLE"
	case FailOutgoing:
		msg = "will not update channel state with downstream FAIL"
	case Commit:
		msg = "will not commit pending channel updates"
	case BogusSettle:
		msg = "will settle HTLC with bogus preimage"
	default:
		msg = "incorrect hodl flag usage"
	}

	return fmt.Sprintf("%s mode enabled -- %s", f, msg)
}
632893
func Flag(v interface{}, short rune, helpvalue ...string) Option {
	return CommandLine.long(v, "", short, helpvalue...)
}
505837
func (cl *CommandLine) RemoveFlag(flag CommandLineFlag) (found bool) {
	return cl.RemoveFlagMatch(func(f CommandLineFlag) bool { return f == flag })
}
745384
func (s *Set) Flag(v interface{}, short rune, helpvalue ...string) Option {
	return s.long(v, "", short, helpvalue...)
}
1310652
func checkFlags(flags map[string]bool, args []string, print func(string)) int {
	num := 0 // Number of valid flags, use to cut out.
	for i, f := range args {
		// Check flag prefix '-'.
		if !strings.HasPrefix(f, "-") {
			// Not a flag, finish check process.
			break
		}

		// Check if it a valid flag.
		if v, ok := flags[f]; ok {
			flags[f] = !v
			if !v {
				print(f)
			} else {
				fmt.Println("DISABLE: " + f)
			}
		} else {
			fmt.Printf("[ERRO] Unknown flag: %s.\n", f)
			return -1
		}
		num = i + 1
	}

	return num
}
1057396
func parseSingleFlagValue(flag string) (name, value string) {
	for i, r := range flag {
		if r == '=' {
			value = flag[i+1:]
			name = flag[0:i]
		}
	}

	// special case of "name"
	if name == "" {
		name = flag
	}

	return
}
38649
func (txn *Txn) Flags(dbi DBI) (uint, error) {
	var cflags C.uint
	ret := C.mdb_dbi_flags(txn._txn, C.MDB_dbi(dbi), (*C.uint)(&cflags))
	return uint(cflags), operrno("mdb_dbi_flags", ret)
}
181811
func (m *Message) Flag(flag string) bool {
	if len(m.Attributes) > 0 {
		return m.Attributes.Flag(flag)
	}
	return false
}
1087714
func FlagByType(fs *flag.FlagSet, structName string, fval reflect.Value, ftype reflect.StructField) {
	// Get a pointer; FlagSet needs a pointer to set the struct's field
	if fval.Kind() == reflect.Ptr {
		// Short-circuit
		log.Printf("Skipping field %s: %s", ftype.Name, ftype.Type.String())
		return
	}
	//log.Printf("Getting pointer to %s", ftype.Name)
	fval = fval.Addr()
	flagName := NameToFlag(ftype.Name)
	flagHelp := fmt.Sprintf("%s:%s", structName, ftype.Name)
	log.Printf("Converting %s => %s", ftype.Name, flagName)

	//log.Printf("Switching on type %s...", ftype.Type.String())
	switch fval := fval.Interface().(type) {
	case *int:
		fs.IntVar(fval, flagName, 0, flagHelp)
	case *float64:
		fs.Float64Var(fval, flagName, 0.0, flagHelp)
	case *string:
		fs.StringVar(fval, flagName, "", flagHelp)
	case *bool:
		fs.BoolVar(fval, flagName, false, flagHelp)
	case *time.Time:
		t := (*time.Time)(fval) // Get a *time.Time pointer to fval
		*t = time.Now()         // Set a default of time.Now()
		fs.Var((*TimeFlag)(fval), flagName, flagHelp)
	default:
		log.Printf("unexpected type %s\n", ftype.Type.String())
	}
}
340386
func Flag(name string, value interface{}) ExecAllocatorOption {
	return func(a *ExecAllocator) {
		a.initFlags[name] = value
	}
}
621462
func (f RegexpFilter) Flags(flags string) RegexpFilter {
	f.flags = &flags
	return f
}
756736
func (q *SimpleQueryStringQuery) Flags(flags string) *SimpleQueryStringQuery {
	q.flags = flags
	return q
}
734070
func CaseInsensitive(tokens ...string) Option {
	return func(p *Parser) error {
		for _, token := range tokens {
			p.caseInsensitive[token] = true
		}
		return nil
	}
}