// reads input flags and interprets the complex ones
552196
func readFlags() {
	flag.Parse()

	if *showUsage {
		flag.Usage()
		os.Exit(0)
	}

	if *debugMode {
		asl.Logger.SetLevel(asl.INFO)
	}

	if *latency != "" {
		latCols, latBase = parseLatency(*latency)
	}

	var binDataSz, workloadPct *int

	binDataType, binDataSz = parseValuedParam(*binDef)
	if binDataSz != nil {
		binDataSize = *binDataSz
	} else {
		switch binDataType {
		case "B":
			binDataSize = 200
		case "S":
			binDataSize = 50
		}
	}

	workloadType, workloadPct = parseValuedParam(*workloadDef)
	if workloadPct != nil {
		workloadPercent = *workloadPct
	} else {
		switch workloadType {
		case "I":
			workloadPercent = 100
		case "RU":
			workloadPercent = 50
		}
	}
}
727321
func (l *tomlLexer) read() rune {
	r := l.peek()
	if r == '\n' {
		l.endbufferLine++
		l.endbufferCol = 1
	} else {
		l.endbufferCol++
	}
	l.inputIdx++
	return r
}
758318
func (iter *Iterator) ReadFloat32() (ret float32) {
	c := iter.nextToken()
	if c == '-' {
		return -iter.readPositiveFloat32()
	}
	iter.unreadByte()
	return iter.readPositiveFloat32()
}
846107
func input() io.Reader {
	if isatty.IsTerminal(os.Stdin.Fd()) {
		return strings.NewReader("{}")
	}

	return os.Stdin
}
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
}
894896
func (v *VerbalExpression) getFlags() string {
	flags := "misU" // warning, follow Flag const order
	result := []rune{}

	for i, flag := range flags {
		if v.flags&(1<<uint(i)) != 0 {
			result = append(result, flag)
		}
	}

	return string(result)
}
793999
func Unvis(input string, flag VisFlag) (string, error) {
	// TODO: Check all of the VisFlag bits.
	p := newParser(input, flag)
	output, err := unvis(p)
	if err != nil {
		return "", fmt.Errorf("unvis: %s", err)
	}
	if !p.End() {
		return "", fmt.Errorf("unvis: trailing characters at end of input")
	}
	return output, nil
}
1071789
func readElements(r io.Reader, elements ...interface{}) error {
	for _, element := range elements {
		err := readElement(r, element)
		if err != nil {
			return err
		}
	}
	return nil
}
688093
func PrintFlags(flags interface{}) {
	t := reflect.TypeOf(flags).Elem()
	if t.NumField() > 0 {
		maxArg := 0
		maxLong := 0
		maxShort := 0
		for i := 0; i < t.NumField(); i++ {
			if t.Field(i).Tag.Get("arg") != "" {
				maxArg = 4
			}
			if long := len(t.Field(i).Tag.Get("long")); long > maxLong {
				maxLong = long
			}
			if short := len(t.Field(i).Tag.Get("short")); short > maxShort {
				maxShort = short
			}
		}
		//formatLong := "    -%" + strconv.Itoa(maxShort) + "s, %" + strconv.Itoa(maxLong) + "s%" + strconv.Itoa(maxArg) + "s : %s\n"
		//formatShort := "     %" + strconv.Itoa(maxShort+maxLong+4) + "s %" + strconv.Itoa(maxArg) + "s : %s\n"
		for i := 0; i < t.NumField(); i++ {
			short := t.Field(i).Tag.Get("short")
			long := t.Field(i).Tag.Get("long")
			arg := t.Field(i).Tag.Get("arg")
			desc := t.Field(i).Tag.Get("desc")
			format := " : %s\n"
			if maxArg > 0 {
				if arg == "true" {
					format = " arg" + format
				} else {
					format = "    " + format
				}
			}
			if long != "" {
				format = "    %" + strconv.Itoa(maxShort+1) + "s, %" + strconv.Itoa(maxLong+2) + "s" + format
				fmt.Printf(format, "-"+short, "--"+long, desc)
			} else {
				format = "    %" + strconv.Itoa(maxShort+maxLong+5) + "s" + format
				fmt.Printf(format, "-"+short, desc)
			}
		}
		print("\n\n")
	}
}
56180
func (m *HeaderCtxFlag) FlagStr() string {
	m.mu.RLock()
	ret := m.expectedVal
	m.mu.RUnlock()
	return ret
}
107367
func (cl *CoLog) Flags() int {
	cl.mu.Lock()
	defer cl.mu.Unlock()
	if cl.formatter == nil {
		return 0
	}

	return cl.formatter.Flags()
}
398875
func ReadSymbols(bs ByteSlice, version int, off int) ([]string, map[uint32]string, error) {
	if off == 0 {
		return nil, nil, nil
	}
	d := encoding.NewDecbufAt(bs, off, castagnoliTable)

	var (
		origLen     = d.Len()
		cnt         = d.Be32int()
		basePos     = uint32(off) + 4
		nextPos     = basePos + uint32(origLen-d.Len())
		symbolSlice []string
		symbols     = map[uint32]string{}
	)
	if version == FormatV2 {
		symbolSlice = make([]string, 0, cnt)
	}

	for d.Err() == nil && d.Len() > 0 && cnt > 0 {
		s := d.UvarintStr()

		if version == FormatV2 {
			symbolSlice = append(symbolSlice, s)
		} else {
			symbols[nextPos] = s
			nextPos = basePos + uint32(origLen-d.Len())
		}
		cnt--
	}
	return symbolSlice, symbols, errors.Wrap(d.Err(), "read symbols")
}
953498
func GetFlags(config interface{}) ([]string, error) {
	flagMap := make(map[string]reflect.StructField)
	if err := getTypesRecursive(reflect.ValueOf(config), flagMap, ""); err != nil {
		return []string{}, err
	}

	flags := make([]string, 0, len(flagMap))
	for f := range flagMap {
		flags = append(flags, f)
	}
	return flags, nil
}
375015
func Flags(flags ...cli.Flag) Option {
	return func(o *Options) {
		o.Flags = append(o.Flags, flags...)
	}
}
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
}
1341922
func interpret(values interface{}) (image.Ref, ImageSetter, bool) {
	switch m := values.(type) {
	case map[string]interface{}:
		return interpretAsContainer(stringMap(m))
	case map[interface{}]interface{}:
		return interpretAsContainer(anyMap(m))
	}
	return image.Ref{}, nil, false
}
1259671
func (c *DumpCommand) VisitAllFlags(fn func(*flag.Flag)) {
	c.flags.VisitAll(fn)
}