// Usage is a replacement usage function for the flags package.
979338
func Usage() {
	fmt.Fprintf(os.Stderr, "Usage of vet:\n")
	fmt.Fprintf(os.Stderr, "\tvet [flags] directory...\n")
	fmt.Fprintf(os.Stderr, "\tvet [flags] files... # Must be a single package\n")
	fmt.Fprintf(os.Stderr, "By default, -all is set and all non-experimental checks are run.\n")
	fmt.Fprintf(os.Stderr, "For more information run\n")
	fmt.Fprintf(os.Stderr, "\tgo doc cmd/vet\n\n")
	fmt.Fprintf(os.Stderr, "Flags:\n")
	flag.PrintDefaults()
	os.Exit(2)
}
1175999
func Usage() {
	if fs != nil && fs.Parsed() {
		fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
		fs.PrintDefaults()
	}
}
1330611
func (o *objectCountEvaluator) UsageStats(options quota.UsageStatsOptions) (quota.UsageStats, error) {
	return CalculateUsageStats(options, o.listFuncByNamespace, MatchesNoScopeFunc, o.Usage)
}
947001
func usage(out io.Writer, a Application, includeAdvanced bool) {
	usageTemplate := `{{.Title}}

Usage:  {{.Name}} [command] [arguments]

Commands:{{range .Commands}}
  {{.Name | printf "%%-%ds"}}  {{.ShortDesc}}{{end}}

{{if .EnvVars}}Environment Variables:{{range .EnvVars}}
  {{.Name | printf "%%-%ds"}}  {{.ShortDesc}}{{if .Default}} (Default: {{.Default | printf "%%q"}}){{end}}{{end}}

{{end}}
Use "{{.Name}} help [command]" for more information about a command.{{if .ShowAdvancedTip}}
Use "{{.Name}} help -advanced" to display all commands.{{end}}

`

	widestCmd := 0
	allCmds := a.GetCommands()
	cmds := make([]*Command, 0, len(allCmds))
	hasAdvanced := false
	for _, c := range allCmds {
		hasAdvanced = hasAdvanced || c.Advanced

		if !c.Advanced || includeAdvanced {
			// We need to include this command
			if namLen := len(c.Name()); namLen > widestCmd {
				widestCmd = namLen
			}
			cmds = append(cmds, c)
		}
	}

	type envVarEntry struct {
		Name      string
		ShortDesc string
		Default   string
	}
	widestEnvVar := 0
	envVars := []envVarEntry(nil)
	if envVarMap := a.GetEnvVars(); len(envVarMap) > 0 {
		envVarKeys := make(sort.StringSlice, 0, len(envVarMap))
		for k, v := range envVarMap {
			if v.Advanced {
				hasAdvanced = true
			}
			if !v.Advanced || includeAdvanced {
				if keyLen := len(k); keyLen > widestEnvVar {
					widestEnvVar = keyLen
				}
				envVarKeys = append(envVarKeys, k)
			}
		}
		envVarKeys.Sort()
		envVars = make([]envVarEntry, 0, len(envVarKeys))
		for _, k := range envVarKeys {
			v := envVarMap[k]
			envVars = append(envVars, envVarEntry{k, v.ShortDesc, v.Default})
		}
	}
	data := map[string]interface{}{
		"Title":           a.GetTitle(),
		"Name":            a.GetName(),
		"Commands":        cmds,
		"EnvVars":         envVars,
		"ShowAdvancedTip": (hasAdvanced && !includeAdvanced),
	}
	tmpl(out, fmt.Sprintf(usageTemplate, widestCmd, widestEnvVar), data)
}
749832
func Use(c context.Context, s Client) context.Context {
	return context.WithValue(c, &contextKey, s)
}
514901
func (b *bitmap) utilization() float32 {
	var avg float32
	for _, block := range b.blocks {
		avg += float32(block.count(0, bmBlockRange-1)) / float32(bmBlockRange)
	}
	return avg / float32(len(b.blocks))
}
545603
func Usage(format string, a ...interface{}) {
	console.ErrStyle("usage", format, a...)
	os.Exit(BadUsage)
}
986465
func (app *App) Use(handle Middleware) *App {
	app.mds = append(app.mds, handle)
	return app
}
761593
func (w *Ware) Use(handler Handler) {
	validateHandler(handler)

	w.handlers = append(w.handlers, handler)
}
1164791
func Use(vv ...string) *Set {
	sort.Strings(vv)
	return &Set{items: vv}
}
537792
func (p *CmdProve) GetUsage() libkb.Usage {
	return libkb.Usage{
		Config:    true,
		API:       true,
		KbKeyring: true,
	}
}
412312
func (f *FlagLoader) Load(s interface{}) error {
	strct := structs.New(s)
	structName := strct.Name()

	flagSet := flag.NewFlagSet(structName, f.ErrorHandling)
	f.flagSet = flagSet

	for _, field := range strct.Fields() {
		f.processField(field.Name(), field)
	}

	flagSet.Usage = func() {
		fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
		flagSet.PrintDefaults()
		fmt.Fprintf(os.Stderr, "\nGenerated environment variables:\n")
		e := &EnvironmentLoader{
			Prefix:    f.EnvPrefix,
			CamelCase: f.CamelCase,
		}
		e.PrintEnvs(s)
		fmt.Println("")
	}

	args := filterArgs(os.Args[1:])
	if f.Args != nil {
		args = f.Args
	}

	return flagSet.Parse(args)
}
1248231
func (*GoFlags) Parse(usage func()) []string {
	flag.Usage = usage
	flag.Parse()
	args := flag.Args()
	if len(args) == 0 {
		usage()
	}
	return args
}
688266
func (c *Command) UsageFunc() (f func(*Command) error) {
	if c.usageFunc != nil {
		return c.usageFunc
	}
	if c.HasParent() {
		return c.Parent().UsageFunc()
	}
	return func(c *Command) error {
		c.mergePersistentFlags()
		err := tmpl(c.OutOrStderr(), c.UsageTemplate(), c)
		if err != nil {
			c.Println(err)
		}
		return err
	}
}
367780
func (o *option) usageName() string {
	// Don't print help messages if we have none and there is only one
	// way to specify the option.
	if o.help == "" && (o.short == 0 || o.long == "") {
		return ""
	}
	n := ""

	switch {
	case o.short != 0 && o.long == "":
		n = "-" + string(o.short)
	case o.short == 0 && o.long != "":
		n = "    --" + o.long
	case o.short != 0 && o.long != "":
		n = "-" + string(o.short) + ", --" + o.long
	}

	switch {
	case o.flag:
		return n
	case o.optional:
		return n + "[=" + o.name + "]"
	case o.long != "":
		return n + "=" + o.name
	}
	return n + " " + o.name
}
643372
func (s *Set) UsageLine() string {
	sort.Sort(s.options)
	flags := ""

	// Build up the list of short flag names and also compute
	// how to display the option in the longer help listing.
	// We also keep track of the longest option usage string
	// that is no more than HelpColumn-3 bytes (at which point
	// we use two lines to display the help).  The three
	// is for the leading space and the two spaces before the
	// help string.
	for _, opt := range s.options {
		if opt.name == "" {
			opt.name = "value"
		}
		if opt.uname == "" {
			opt.uname = opt.usageName()
		}
		if opt.flag && opt.short != 0 && opt.short != '-' {
			flags += string(opt.short)
		}
	}

	var opts []string

	// The short option - is special
	if s.shortOptions['-'] != nil {
		opts = append(opts, "-")
	}

	// If we have a bundle of flags, add them to the list
	if flags != "" {
		opts = append(opts, "-"+flags)
	}

	// Now append all the long options and options that require
	// values.
	for _, opt := range s.options {
		if opt.flag {
			if opt.short != 0 {
				continue
			}
			flags = "--" + opt.long
		} else if opt.short != 0 {
			flags = "-" + string(opt.short) + " " + opt.name
		} else {
			flags = "--" + string(opt.long) + " " + opt.name
		}
		opts = append(opts, flags)
	}
	flags = strings.Join(opts, "] [")
	if flags != "" {
		flags = "[" + flags + "]"
	}
	return flags
}
86344
func defaultUsage(fs *FlagSet) {
	if fs.name == "" {
		fmt.Fprintf(fs.Out(), "Usage:\n")
	} else {
		fmt.Fprintf(fs.Out(), "Usage of %s:\n", fs.name)
	}
	fs.PrintDefaults()
}