func (f *FlagSet) String(names []string, value string, usage string) *string {
	p := new(string)
	f.StringVar(p, names, value, usage)
	return p
}
String defines a string flag with specified name, default value, and usage string.
The return value is the address of a string variable that stores the value of the flag.
package mflag
import (
	"errors"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
	"strings"
	"text/tabwriter"
	"time"
)
var ErrHelp = errors.New("flag: help requested")
var ErrRetry = errors.New("flag: retry")
type boolValue bool
func newBoolValue(val bool, p *bool) *boolValue {
	*p = val
	return (*boolValue)(p)
}
func (b *boolValue) Set(s string) error {
	v, err := strconv.ParseBool(s)
	*b = boolValue(v)
	return err
}
func (b *boolValue) Get() interface{} { return bool(*b) }
func (b *boolValue) String() string { return fmt.Sprintf("%v", *b) }
func (b *boolValue) IsBoolFlag() bool { return true }
type boolFlag interface {
	Value
	IsBoolFlag() bool
}
type intValue int
func newIntValue(val int, p *int) *intValue {
	*p = val
	return (*intValue)(p)
}
func (i *intValue) Set(s string) error {
	v, err := strconv.ParseInt(s, 0, 64)
	*i = intValue(v)
	return err
}
func (i *intValue) Get() interface{} { return int(*i) }
func (i *intValue) String() string { return fmt.Sprintf("%v", *i) }
type int64Value int64
func newInt64Value(val int64, p *int64) *int64Value {
	*p = val
	return (*int64Value)(p)
}
func (i *int64Value) Set(s string) error {
	v, err := strconv.ParseInt(s, 0, 64)
	*i = int64Value(v)
	return err
}
func (i *int64Value) Get() interface{} { return int64(*i) }
func (i *int64Value) String() string { return fmt.Sprintf("%v", *i) }
type uintValue uint
func newUintValue(val uint, p *uint) *uintValue {
	*p = val
	return (*uintValue)(p)
}
func (i *uintValue) Set(s string) error {
	v, err := strconv.ParseUint(s, 0, 64)
	*i = uintValue(v)
	return err
}
func (i *uintValue) Get() interface{} { return uint(*i) }
func (i *uintValue) String() string { return fmt.Sprintf("%v", *i) }
type uint64Value uint64
func newUint64Value(val uint64, p *uint64) *uint64Value {
	*p = val
	return (*uint64Value)(p)
}
func (i *uint64Value) Set(s string) error {
	v, err := strconv.ParseUint(s, 0, 64)
	*i = uint64Value(v)
	return err
}
func (i *uint64Value) Get() interface{} { return uint64(*i) }
func (i *uint64Value) String() string { return fmt.Sprintf("%v", *i) }
type stringValue string
func newStringValue(val string, p *string) *stringValue {
	*p = val
	return (*stringValue)(p)
}
func (s *stringValue) Set(val string) error {
	*s = stringValue(val)
	return nil
}
func (s *stringValue) Get() interface{} { return string(*s) }
func (s *stringValue) String() string { return fmt.Sprintf("%s", *s) }
type float64Value float64
func newFloat64Value(val float64, p *float64) *float64Value {
	*p = val
	return (*float64Value)(p)
}
func (f *float64Value) Set(s string) error {
	v, err := strconv.ParseFloat(s, 64)
	*f = float64Value(v)
	return err
}
func (f *float64Value) Get() interface{} { return float64(*f) }
func (f *float64Value) String() string { return fmt.Sprintf("%v", *f) }
type durationValue time.Duration
func newDurationValue(val time.Duration, p *time.Duration) *durationValue {
	*p = val
	return (*durationValue)(p)
}
func (d *durationValue) Set(s string) error {
	v, err := time.ParseDuration(s)
	*d = durationValue(v)
	return err
}
func (d *durationValue) Get() interface{} { return time.Duration(*d) }
func (d *durationValue) String() string { return (*time.Duration)(d).String() }
type Value interface {
	String() string
	Set(string) error
}
type Getter interface {
	Value
	Get() interface{}
}
type ErrorHandling int
const (
	ContinueOnError ErrorHandling = iota
	ExitOnError
	PanicOnError
)
type FlagSet struct {
	Usage func()
	name             string
	parsed           bool
	actual           map[string]*Flag
	formal           map[string]*Flag
	args             []string  
	errorHandling    ErrorHandling
	output           io.Writer  
	nArgRequirements []nArgRequirement
}
type Flag struct {
	Names    []string  
	Usage    string    
	Value    Value     
	DefValue string    
}
type flagSlice []string
func (p flagSlice) Len() int { return len(p) }
func (p flagSlice) Less(i, j int) bool {
	pi, pj := strings.TrimPrefix(p[i], "-"), strings.TrimPrefix(p[j], "-")
	lpi, lpj := strings.ToLower(pi), strings.ToLower(pj)
	if lpi != lpj {
		return lpi < lpj
	}
	return pi < pj
}
func (p flagSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
func sortFlags(flags map[string]*Flag) []*Flag {
	var list flagSlice
	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
}
func (f *FlagSet) Name() string {
	return f.name
}
func (f *FlagSet) Out() io.Writer {
	if f.output == nil {
		return os.Stderr
	}
	return f.output
}
func (f *FlagSet) SetOutput(output io.Writer) {
	f.output = output
}
func (f *FlagSet) VisitAll(fn func(*Flag)) {
	for _, flag := range sortFlags(f.formal) {
		fn(flag)
	}
}
func VisitAll(fn func(*Flag)) {
	CommandLine.VisitAll(fn)
}
func (f *FlagSet) Visit(fn func(*Flag)) {
	for _, flag := range sortFlags(f.actual) {
		fn(flag)
	}
}
func Visit(fn func(*Flag)) {
	CommandLine.Visit(fn)
}
func (f *FlagSet) Lookup(name string) *Flag {
	return f.formal[name]
}
func (f *FlagSet) IsSet(name string) bool {
	return f.actual[name] != nil
}
func Lookup(name string) *Flag {
	return CommandLine.formal[name]
}
func IsSet(name string) bool {
	return CommandLine.IsSet(name)
}
type nArgRequirementType int
const (
	Exact nArgRequirementType = iota
	Max
	Min
)
type nArgRequirement struct {
	Type nArgRequirementType
	N    int
}
func (f *FlagSet) Require(nArgRequirementType nArgRequirementType, nArg int) {
	f.nArgRequirements = append(f.nArgRequirements, nArgRequirement{nArgRequirementType, nArg})
}
func (f *FlagSet) CheckArgs() (message string) {
	for _, req := range f.nArgRequirements {
		var arguments string
		if req.N == 1 {
			arguments = "1 argument"
		} else {
			arguments = fmt.Sprintf("%d arguments", req.N)
		}
		str := func(kind string) string {
			return fmt.Sprintf("%q requires %s%s", f.name, kind, arguments)
		}
		switch req.Type {
		case Exact:
			if f.NArg() != req.N {
				return str("")
			}
		case Max:
			if f.NArg() > req.N {
				return str("a maximum of ")
			}
		case Min:
			if f.NArg() < req.N {
				return str("a minimum of ")
			}
		}
	}
	return ""
}
func (f *FlagSet) Set(name, value string) error {
	flag, ok := f.formal[name]
	if !ok {
		return fmt.Errorf("no such flag -%v", name)
	}
	err := flag.Value.Set(value)
	if err != nil {
		return err
	}
	if f.actual == nil {
		f.actual = make(map[string]*Flag)
	}
	f.actual[name] = flag
	return nil
}
func Set(name, value string) error {
	return CommandLine.Set(name, value)
}
func (f *FlagSet) PrintDefaults() {
	writer := tabwriter.NewWriter(f.Out(), 20, 1, 3, ' ', 0)
	f.VisitAll(func(flag *Flag) {
		format := "  -%s=%s"
		if _, ok := flag.Value.(*stringValue); ok {
			format = "  -%s=%q"
		}
		names := []string{}
		for _, name := range flag.Names {
			if name[0] != '#' {
				names = append(names, name)
			}
		}
		if len(names) > 0 {
			fmt.Fprintf(writer, format, strings.Join(names, ", -"), flag.DefValue)
			for i, line := range strings.Split(flag.Usage, "\n") {
				if i != 0 {
					line = "  " + line
				}
				fmt.Fprintln(writer, "\t", line)
			}
		}
	})
	writer.Flush()
}
func PrintDefaults() {
	CommandLine.PrintDefaults()
}
func defaultUsage(f *FlagSet) {
	if f.name == "" {
		fmt.Fprintf(f.Out(), "Usage:\n")
	} else {
		fmt.Fprintf(f.Out(), "Usage of %s:\n", f.name)
	}
	f.PrintDefaults()
}
var Usage = func() {
	fmt.Fprintf(CommandLine.output, "Usage of %s:\n", os.Args[0])
	PrintDefaults()
}
func (f *FlagSet) FlagCount() int { return len(sortFlags(f.formal)) }
func (f *FlagSet) FlagCountUndeprecated() int {
	count := 0
	for _, flag := range sortFlags(f.formal) {
		for _, name := range flag.Names {
			if name[0] != '#' {
				count++
				break
			}
		}
	}
	return count
}
func (f *FlagSet) NFlag() int { return len(f.actual) }
func NFlag() int { return len(CommandLine.actual) }
func (f *FlagSet) Arg(i int) string {
	if i < 0 || i >= len(f.args) {
		return ""
	}
	return f.args[i]
}
func Arg(i int) string {
	return CommandLine.Arg(i)
}
func (f *FlagSet) NArg() int { return len(f.args) }
func NArg() int { return len(CommandLine.args) }
func (f *FlagSet) Args() []string { return f.args }
func Args() []string { return CommandLine.args }
func (f *FlagSet) BoolVar(p *bool, names []string, value bool, usage string) {
	f.Var(newBoolValue(value, p), names, usage)
}
func BoolVar(p *bool, names []string, value bool, usage string) {
	CommandLine.Var(newBoolValue(value, p), names, usage)
}
func (f *FlagSet) Bool(names []string, value bool, usage string) *bool {
	p := new(bool)
	f.BoolVar(p, names, value, usage)
	return p
}
func Bool(names []string, value bool, usage string) *bool {
	return CommandLine.Bool(names, value, usage)
}
func (f *FlagSet) IntVar(p *int, names []string, value int, usage string) {
	f.Var(newIntValue(value, p), names, usage)
}
func IntVar(p *int, names []string, value int, usage string) {
	CommandLine.Var(newIntValue(value, p), names, usage)
}
func (f *FlagSet) Int(names []string, value int, usage string) *int {
	p := new(int)
	f.IntVar(p, names, value, usage)
	return p
}
func Int(names []string, value int, usage string) *int {
	return CommandLine.Int(names, value, usage)
}
func (f *FlagSet) Int64Var(p *int64, names []string, value int64, usage string) {
	f.Var(newInt64Value(value, p), names, usage)
}
func Int64Var(p *int64, names []string, value int64, usage string) {
	CommandLine.Var(newInt64Value(value, p), names, usage)
}
func (f *FlagSet) Int64(names []string, value int64, usage string) *int64 {
	p := new(int64)
	f.Int64Var(p, names, value, usage)
	return p
}
func Int64(names []string, value int64, usage string) *int64 {
	return CommandLine.Int64(names, value, usage)
}
func (f *FlagSet) UintVar(p *uint, names []string, value uint, usage string) {
	f.Var(newUintValue(value, p), names, usage)
}
func UintVar(p *uint, names []string, value uint, usage string) {
	CommandLine.Var(newUintValue(value, p), names, usage)
}
func (f *FlagSet) Uint(names []string, value uint, usage string) *uint {
	p := new(uint)
	f.UintVar(p, names, value, usage)
	return p
}
func Uint(names []string, value uint, usage string) *uint {
	return CommandLine.Uint(names, value, usage)
}
func (f *FlagSet) Uint64Var(p *uint64, names []string, value uint64, usage string) {
	f.Var(newUint64Value(value, p), names, usage)
}
func Uint64Var(p *uint64, names []string, value uint64, usage string) {
	CommandLine.Var(newUint64Value(value, p), names, usage)
}
func (f *FlagSet) Uint64(names []string, value uint64, usage string) *uint64 {
	p := new(uint64)
	f.Uint64Var(p, names, value, usage)
	return p
}
func Uint64(names []string, value uint64, usage string) *uint64 {
	return CommandLine.Uint64(names, value, usage)
}
func (f *FlagSet) StringVar(p *string, names []string, value string, usage string) {
	f.Var(newStringValue(value, p), names, usage)
}
func StringVar(p *string, names []string, value string, usage string) {
	CommandLine.Var(newStringValue(value, p), names, usage)
}