8 func newInt64Value(val int64, p *int64) *int64Value {
10 return (*int64Value)(p)
13 func (i *int64Value) Set(s string) error {
14 v, err := strconv.ParseInt(s, 0, 64)
19 func (i *int64Value) Type() string {
23 func (i *int64Value) String() string { return strconv.FormatInt(int64(*i), 10) }
25 func int64Conv(sval string) (interface{}, error) {
26 return strconv.ParseInt(sval, 0, 64)
29 // GetInt64 return the int64 value of a flag with the given name
30 func (f *FlagSet) GetInt64(name string) (int64, error) {
31 val, err := f.getFlagType(name, "int64", int64Conv)
35 return val.(int64), nil
38 // Int64Var defines an int64 flag with specified name, default value, and usage string.
39 // The argument p points to an int64 variable in which to store the value of the flag.
40 func (f *FlagSet) Int64Var(p *int64, name string, value int64, usage string) {
41 f.VarP(newInt64Value(value, p), name, "", usage)
44 // Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash.
45 func (f *FlagSet) Int64VarP(p *int64, name, shorthand string, value int64, usage string) {
46 f.VarP(newInt64Value(value, p), name, shorthand, usage)
49 // Int64Var defines an int64 flag with specified name, default value, and usage string.
50 // The argument p points to an int64 variable in which to store the value of the flag.
51 func Int64Var(p *int64, name string, value int64, usage string) {
52 CommandLine.VarP(newInt64Value(value, p), name, "", usage)
55 // Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash.
56 func Int64VarP(p *int64, name, shorthand string, value int64, usage string) {
57 CommandLine.VarP(newInt64Value(value, p), name, shorthand, usage)
60 // Int64 defines an int64 flag with specified name, default value, and usage string.
61 // The return value is the address of an int64 variable that stores the value of the flag.
62 func (f *FlagSet) Int64(name string, value int64, usage string) *int64 {
64 f.Int64VarP(p, name, "", value, usage)
68 // Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash.
69 func (f *FlagSet) Int64P(name, shorthand string, value int64, usage string) *int64 {
71 f.Int64VarP(p, name, shorthand, value, usage)
75 // Int64 defines an int64 flag with specified name, default value, and usage string.
76 // The return value is the address of an int64 variable that stores the value of the flag.
77 func Int64(name string, value int64, usage string) *int64 {
78 return CommandLine.Int64P(name, "", value, usage)
81 // Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash.
82 func Int64P(name, shorthand string, value int64, usage string) *int64 {
83 return CommandLine.Int64P(name, shorthand, value, usage)