Documentation
¶
Overview ¶
Package extensions provides extensions to the github.com/spf13/pflag package.
TODO: expose pflag string_array and []byte as base64
Index ¶
- func ByteSize(name string, defaultValue uint64, usage string) *uint64
- func ByteSizeP(name, shorthand string, defaultValue uint64, usage string) *uint64
- func ByteSizeVar(p *uint64, name string, defaultValue uint64, usage string)
- func ByteSizeVarP(p *uint64, name, shorthand string, defaultValue uint64, usage string)
- func Count(name string, defaultValue int, usage string) *int
- func CountP(name, shorthand string, defaultValue int, usage string) *int
- func CountVar(p *int, name string, defaultValue int, usage string)
- func CountVarP(p *int, name, shorthand string, defaultValue int, usage string)
- type ByteSizeValue
- type CountValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteSize ¶
ByteSize defines an uint64 flag with the specified name, default value, and usage string.
The return value is the address of an uint64 variable that stores the value of the flag.
func ByteSizeP ¶
ByteSizeP is like ByteSize, but accepts a shorthand letter that can be used after a single dash.
func ByteSizeVar ¶
ByteSizeVar defines a byte-size flag wih name, default value and usage string. The flag is set on the default pflag.CommandLine flagset.
The flag value is stored at address p.
func ByteSizeVarP ¶
ByteSizeVarP is like ByteSize, and takes a shorthand for the flag name.
func Count ¶
Count defines a count 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. A count flag will add 1 to its value evey time it is found on the command line
Types ¶
type ByteSizeValue ¶
type ByteSizeValue uint64
ByteSizeValue is used to pass human-readable byte sizes as flags.
func NewByteSizeValue ¶
func NewByteSizeValue(defaultValue uint64, p *uint64) *ByteSizeValue
NewByteSizeValue builds a ByteSizeValue.
func (ByteSizeValue) MarshalFlag ¶
func (b ByteSizeValue) MarshalFlag() (string, error)
MarshalFlag implements go-flags Marshaller interface
func (*ByteSizeValue) Set ¶
func (b *ByteSizeValue) Set(value string) error
Set the value of this bytesize (pflag value interfaces)
func (ByteSizeValue) String ¶
func (b ByteSizeValue) String() string
String method for a bytesize (pflag value and stringer interface)
func (*ByteSizeValue) Type ¶
func (b *ByteSizeValue) Type() string
Type returns the type of the pflag value (pflag value interface)
func (*ByteSizeValue) UnmarshalFlag ¶
func (b *ByteSizeValue) UnmarshalFlag(value string) error
UnmarshalFlag implements go-flags Unmarshaller interface
type CountValue ¶
type CountValue int
CountValue is used to pass increment/decrement counts as flags.
func NewCountValue ¶
func NewCountValue(defaultValue int, p *int) *CountValue
func (*CountValue) Set ¶
func (i *CountValue) Set(s string) error
func (*CountValue) String ¶
func (i *CountValue) String() string
func (*CountValue) Type ¶
func (i *CountValue) Type() string