// flag type returns the correct flag type for the Go signatures
962144
func flagType(name string) string {
	switch name {
	case "cuCtxCreate", "cuDevicePrimaryCtxSetFlags":
		return "ContextFlags"
	case "cuLinkCreate":
		panic("Unhandled")
	case "cuStreamCreate", "cuStreamCreateWithPriority":
		return "StreamFlags"
	case "cuEventCreate":
		return "EventFlags"
	case "cuTexRefSetFlags":
		return "TexRefFlags"
	default:
		log.Printf("Unreachable flagtype %v", name)
	}
	panic("Unreachable")
}
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)
	}
}
140017
func Flags(f byte) Field {
	return func(p *Packet) error {
		return p.append(flags, []byte{f})
	}
}
717700
func (q RegexpQuery) Flags(flags string) RegexpQuery {
	q.flags = &flags
	return q
}
992257
func (f *Field) Type() string {
	f.mu.RLock()
	defer f.mu.RUnlock()
	return f.options.Type
}
1004615
func (s *ScanService) Type(typ string) *ScanService {
	if s.types == nil {
		s.types = make([]string, 0)
	}
	s.types = append(s.types, typ)
	return s
}
56532
func (r *ReindexDestination) Type(typ string) *ReindexDestination {
	r.typ = typ
	return r
}
654191
func Flag(name string, defv interface{}, usage string) V {
	return flagA(flagT{
		name:  name,
		defv:  defv,
		usage: usage,
	})
}
280281
func (s *IndicesStatsService) Type(types ...string) *IndicesStatsService {
	s.types = append(s.types, types...)
	return s
}
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
}
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
}
1074977
func (c *Context) VerifySelectiveFlags(flags uint32) error {
	if valid, missing, extra := verifySelectiveFlags(flags, c.RequestedFlags); !valid {
		return fmt.Errorf("sspi: invalid flags check: desired=%b requested=%b missing=%b extra=%b", flags, c.RequestedFlags, missing, extra)
	}
	if valid, missing, extra := verifySelectiveFlags(flags, c.EstablishedFlags); !valid {
		return fmt.Errorf("sspi: invalid flags: desired=%b established=%b missing=%b extra=%b", flags, c.EstablishedFlags, missing, extra)
	}
	return nil
}
775224
func (q *MultiMatchQuery) Type(typ string) *MultiMatchQuery {
	var zero = float64(0.0)
	var one = float64(1.0)

	switch strings.ToLower(typ) {
	default: // best_fields / boolean
		q.typ = "best_fields"
		q.tieBreaker = &zero
	case "most_fields":
		q.typ = "most_fields"
		q.tieBreaker = &one
	case "cross_fields":
		q.typ = "cross_fields"
		q.tieBreaker = &zero
	case "phrase":
		q.typ = "phrase"
		q.tieBreaker = &zero
	case "phrase_prefix":
		q.typ = "phrase_prefix"
		q.tieBreaker = &zero
	}
	return q
}
500570
func (ftp *FTP) Type(t TypeCode) error {
	_, err := ftp.cmd(StatusOK, "TYPE %s", t)
	return err
}
437230
func (s *ScriptSort) Type(typ string) *ScriptSort {
	s.typ = typ
	return s
}
1074781
func (q *SearchSortField) Type(value string) *SearchSortField {
	q.options["type"] = value
	return q
}
375015
func Flags(flags ...cli.Flag) Option {
	return func(o *Options) {
		o.Flags = append(o.Flags, flags...)
	}
}