6 type uint16Value uint16
8 func newUint16Value(val uint16, p *uint16) *uint16Value {
10 return (*uint16Value)(p)
13 func (i *uint16Value) Set(s string) error {
14 v, err := strconv.ParseUint(s, 0, 16)
19 func (i *uint16Value) Type() string {
23 func (i *uint16Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
25 func uint16Conv(sval string) (interface{}, error) {
26 v, err := strconv.ParseUint(sval, 0, 16)
33 // GetUint16 return the uint16 value of a flag with the given name
34 func (f *FlagSet) GetUint16(name string) (uint16, error) {
35 val, err := f.getFlagType(name, "uint16", uint16Conv)
39 return val.(uint16), nil
42 // Uint16Var defines a uint flag with specified name, default value, and usage string.
43 // The argument p points to a uint variable in which to store the value of the flag.
44 func (f *FlagSet) Uint16Var(p *uint16, name string, value uint16, usage string) {
45 f.VarP(newUint16Value(value, p), name, "", usage)
48 // Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash.
49 func (f *FlagSet) Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) {
50 f.VarP(newUint16Value(value, p), name, shorthand, usage)
53 // Uint16Var defines a uint flag with specified name, default value, and usage string.
54 // The argument p points to a uint variable in which to store the value of the flag.
55 func Uint16Var(p *uint16, name string, value uint16, usage string) {
56 CommandLine.VarP(newUint16Value(value, p), name, "", usage)
59 // Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash.
60 func Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) {
61 CommandLine.VarP(newUint16Value(value, p), name, shorthand, usage)
64 // Uint16 defines a uint flag with specified name, default value, and usage string.
65 // The return value is the address of a uint variable that stores the value of the flag.
66 func (f *FlagSet) Uint16(name string, value uint16, usage string) *uint16 {
68 f.Uint16VarP(p, name, "", value, usage)
72 // Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash.
73 func (f *FlagSet) Uint16P(name, shorthand string, value uint16, usage string) *uint16 {
75 f.Uint16VarP(p, name, shorthand, value, usage)
79 // Uint16 defines a uint flag with specified name, default value, and usage string.
80 // The return value is the address of a uint variable that stores the value of the flag.
81 func Uint16(name string, value uint16, usage string) *uint16 {
82 return CommandLine.Uint16P(name, "", value, usage)
85 // Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash.
86 func Uint16P(name, shorthand string, value uint16, usage string) *uint16 {
87 return CommandLine.Uint16P(name, shorthand, value, usage)