package pflagimport// -- int Valuetype intValue intfunc newIntValue( int, *int) *intValue { * = return (*intValue)()}func ( *intValue) ( string) error { , := strconv.ParseInt(, 0, 64) * = intValue()return}func ( *intValue) () string {return"int"}func ( *intValue) () string { returnstrconv.Itoa(int(*)) }func intConv( string) (interface{}, error) {returnstrconv.Atoi()}// GetInt return the int value of a flag with the given namefunc ( *FlagSet) ( string) (int, error) { , := .getFlagType(, "int", intConv)if != nil {return0, }return .(int), nil}// IntVar defines an int flag with specified name, default value, and usage string.// The argument p points to an int variable in which to store the value of the flag.func ( *FlagSet) ( *int, string, int, string) { .VarP(newIntValue(, ), , "", )}// IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash.func ( *FlagSet) ( *int, , string, int, string) { .VarP(newIntValue(, ), , , )}// IntVar defines an int flag with specified name, default value, and usage string.// The argument p points to an int variable in which to store the value of the flag.func ( *int, string, int, string) {CommandLine.VarP(newIntValue(, ), , "", )}// IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash.func ( *int, , string, int, string) {CommandLine.VarP(newIntValue(, ), , , )}// Int defines an int flag with specified name, default value, and usage string.// The return value is the address of an int variable that stores the value of the flag.func ( *FlagSet) ( string, int, string) *int { := new(int) .IntVarP(, , "", , )return}// IntP is like Int, but accepts a shorthand letter that can be used after a single dash.func ( *FlagSet) (, string, int, string) *int { := new(int) .IntVarP(, , , , )return}// Int defines an int flag with specified name, default value, and usage string.// The return value is the address of an int variable that stores the value of the flag.func ( string, int, string) *int {returnCommandLine.IntP(, "", , )}// IntP is like Int, but accepts a shorthand letter that can be used after a single dash.func (, string, int, string) *int {returnCommandLine.IntP(, , , )}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.