diff options
author | Victor Häggqvist <[email protected]> | 2018-03-05 22:19:22 +0100 |
---|---|---|
committer | Victor Häggqvist <[email protected]> | 2018-03-05 22:19:22 +0100 |
commit | f96b7fc1e15ad88c80814e6b153c74453098f499 (patch) | |
tree | 92813eab3a38ad4f177bedef5e5c402bec8a9699 /vendor/github.com/victorhaggqvist/pflag/uint16.go | |
parent | 6e1582f6e7f4148c25e58dc44a080d441e95db85 (diff) |
update vendor to use dep
Diffstat (limited to '')
-rw-r--r-- | vendor/github.com/victorhaggqvist/pflag/uint16.go | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/vendor/github.com/victorhaggqvist/pflag/uint16.go b/vendor/github.com/victorhaggqvist/pflag/uint16.go new file mode 100644 index 0000000..182dc40 --- /dev/null +++ b/vendor/github.com/victorhaggqvist/pflag/uint16.go @@ -0,0 +1,71 @@ +package pflag + +import ( + "fmt" + "strconv" +) + +// -- uint16 value +type uint16Value uint16 + +func newUint16Value(val uint16, p *uint16) *uint16Value { + *p = val + return (*uint16Value)(p) +} +func (i *uint16Value) String() string { return fmt.Sprintf("%d", *i) } +func (i *uint16Value) Set(s string) error { + v, err := strconv.ParseUint(s, 0, 16) + *i = uint16Value(v) + return err +} +func (i *uint16Value) Get() interface{} { + return uint16(*i) +} + +// Uint16Var defines a uint flag with specified name, default value, and usage string. +// The argument p points to a uint variable in which to store the value of the flag. +func (f *FlagSet) Uint16Var(p *uint16, name string, value uint16, usage string) { + f.VarP(newUint16Value(value, p), name, "", usage) +} + +// Like Uint16Var, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) { + f.VarP(newUint16Value(value, p), name, shorthand, usage) +} + +// Uint16Var defines a uint flag with specified name, default value, and usage string. +// The argument p points to a uint variable in which to store the value of the flag. +func Uint16Var(p *uint16, name string, value uint16, usage string) { + CommandLine.VarP(newUint16Value(value, p), name, "", usage) +} + +// Like Uint16Var, but accepts a shorthand letter that can be used after a single dash. +func Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) { + CommandLine.VarP(newUint16Value(value, p), name, shorthand, usage) +} + +// Uint16 defines a uint flag with specified name, default value, and usage string. +// The return value is the address of a uint variable that stores the value of the flag. +func (f *FlagSet) Uint16(name string, value uint16, usage string) *uint16 { + p := new(uint16) + f.Uint16VarP(p, name, "", value, usage) + return p +} + +// Like Uint16, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Uint16P(name, shorthand string, value uint16, usage string) *uint16 { + p := new(uint16) + f.Uint16VarP(p, name, shorthand, value, usage) + return p +} + +// Uint16 defines a uint flag with specified name, default value, and usage string. +// The return value is the address of a uint variable that stores the value of the flag. +func Uint16(name string, value uint16, usage string) *uint16 { + return CommandLine.Uint16P(name, "", value, usage) +} + +// Like Uint16, but accepts a shorthand letter that can be used after a single dash. +func Uint16P(name, shorthand string, value uint16, usage string) *uint16 { + return CommandLine.Uint16P(name, shorthand, value, usage) +} |