Documentation ¶
Overview ¶
Package flags creates a augmentation on the native flags package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BoolFlag ¶
type BoolFlag struct { Name string Desc string Default bool Validation func(bool) error // contains filtered or unexported fields }
BoolFlag implements a structure for parsing bool flags.
func (*BoolFlag) DefaultValue ¶
func (s *BoolFlag) DefaultValue() interface{}
DefaultValue returns default value of flag pointer.
type Command ¶
type Command struct { Name string Desc string ShortDesc string Flags []Flag Action Action Usages []string // AllowDefault is used when only one command is provided to flags, and we want it // to be executable as default action when binary is called. AllowDefault bool // @Deprecated WaitOnCtrlC bool }
Command defines structures which define specific actions to be executed with associated flags. Commands provided will have their ShortDesc trimmed to 100 in length, so ensure to have what you wanna say fit 100 and put more detail explanations in Desc field.
type DurationFlag ¶
type DurationFlag struct { Name string Desc string Default time.Duration Validation func(time.Duration) error // contains filtered or unexported fields }
DurationFlag implements a structure for parsing duration flags.
func (*DurationFlag) DefaultValue ¶
func (s *DurationFlag) DefaultValue() interface{}
DefaultValue returns default value of flag pointer.
func (*DurationFlag) FlagName ¶
func (s *DurationFlag) FlagName() string
FlagName returns name of flag.
func (*DurationFlag) Parse ¶
func (s *DurationFlag) Parse(cmd string) error
Parse sets the underline flag ready for value receiving.
func (*DurationFlag) Value ¶
func (s *DurationFlag) Value() interface{}
Value returns internal value of flag pointer.
type Flag ¶
type Flag interface { FlagName() string Value() interface{} Parse(string) error DefaultValue() interface{} }
Flag defines a interface exposing a single function for parsing a giving flag for attaching and data collection.
type Float64Flag ¶
type Float64Flag struct { Name string Desc string Default float64 Validation func(float64) error // contains filtered or unexported fields }
Float64Flag implements a structure for parsing float64 flags.
func (*Float64Flag) DefaultValue ¶
func (s *Float64Flag) DefaultValue() interface{}
DefaultValue returns default value of flag pointer.
func (*Float64Flag) FlagName ¶
func (s *Float64Flag) FlagName() string
FlagName returns name of flag.
func (*Float64Flag) Parse ¶
func (s *Float64Flag) Parse(cmd string) error
Parse sets the underline flag ready for value receiving.
func (*Float64Flag) Value ¶
func (s *Float64Flag) Value() interface{}
Value returns internal value of flag pointer.
type Int64Flag ¶
type Int64Flag struct { Name string Desc string Default int64 Validation func(int64) error // contains filtered or unexported fields }
Int64Flag implements a structure for parsing int64 flags.
func (*Int64Flag) DefaultValue ¶
func (s *Int64Flag) DefaultValue() interface{}
DefaultValue returns default value of flag pointer.
type IntFlag ¶
type IntFlag struct { Name string Desc string Default int Validation func(int) error // contains filtered or unexported fields }
IntFlag implements a structure for parsing int flags.
func (*IntFlag) DefaultValue ¶
func (s *IntFlag) DefaultValue() interface{}
DefaultValue returns default value of flag pointer.
type StringFlag ¶
type StringFlag struct { Name string Desc string Default string Validation func(string) error // contains filtered or unexported fields }
StringFlag implements a structure for parsing string flags.
func (*StringFlag) DefaultValue ¶
func (s *StringFlag) DefaultValue() interface{}
DefaultValue returns default value of flag pointer.
func (*StringFlag) Parse ¶
func (s *StringFlag) Parse(cmd string) error
Parse sets the underline flag ready for value receiving.
func (*StringFlag) Value ¶
func (s *StringFlag) Value() interface{}
Value returns internal value of flag pointer.
type TBoolFlag ¶
type TBoolFlag struct { Name string Desc string Default bool Validation func(bool) error // contains filtered or unexported fields }
TBoolFlag implements a structure for parsing bool flags that are true by default.
func (*TBoolFlag) DefaultValue ¶
func (s *TBoolFlag) DefaultValue() interface{}
DefaultValue returns default value of flag pointer.
type UInt64Flag ¶
type UInt64Flag struct { Name string Desc string Default uint64 Validation func(uint64) error // contains filtered or unexported fields }
UInt64Flag implements a structure for parsing uint64 flags.
func (*UInt64Flag) DefaultValue ¶
func (s *UInt64Flag) DefaultValue() interface{}
DefaultValue returns default value of flag pointer.
func (*UInt64Flag) Parse ¶
func (s *UInt64Flag) Parse(cmd string) error
Parse sets the underline flag ready for value receiving.
func (*UInt64Flag) Value ¶
func (s *UInt64Flag) Value() interface{}
Value returns internal value of flag pointer.
type UIntFlag ¶
type UIntFlag struct { Name string Desc string Default uint Validation func(uint) error // contains filtered or unexported fields }
UIntFlag implements a structure for parsing uint flags.
func (*UIntFlag) DefaultValue ¶
func (s *UIntFlag) DefaultValue() interface{}
DefaultValue returns default value of flag pointer.