Documentation
¶
Index ¶
- Constants
- func ToBoolType(value string) (v, isBool bool)
- type EventArgs
- func (e *EventArgs) GetAsBool(name ...string) bool
- func (e *EventArgs) GetAsInteger(name ...string) (vI int64, ok bool)
- func (e *EventArgs) GetAsString(name ...string) string
- func (e *EventArgs) GetAsStringOrRaw(name ...string) string
- func (e *EventArgs) GetAsStringT(name ...string) string
- func (e *EventArgs) GetAsStringTOrRaw(name ...string) string
- func (e *EventArgs) GetCommand() string
- func (e *EventArgs) GetFlag(names ...string) *Flag
- func (e *EventArgs) GetFlags() []Flag
- func (e *EventArgs) GetIndexFlag(index int) *Flag
- func (e *EventArgs) GetLength() int
- func (e *EventArgs) HasFlag(names ...string) bool
- func (e *EventArgs) HasFlags(names ...string) bool
- func (e *EventArgs) IsEmpty() bool
- func (e *EventArgs) IsEmptyOrRaw() bool
- type Flag
- func (f *Flag) GetAsBool() bool
- func (f *Flag) GetAsInteger() (vI int64, ok bool)
- func (f *Flag) GetAsString() string
- func (f *Flag) GetIndex() int
- func (f *Flag) GetName() string
- func (f *Flag) GetType() FlagType
- func (f *Flag) GetValue() interface{}
- func (f *Flag) GetValueAndType() (interface{}, FlagType)
- type FlagType
- type Hlc
- type HlcCollection
Constants ¶
const ( NoneTypeStr = "None" BoolTypeStr = "bool" StringTypeStr = "string" UInt8TypeStr = "uint8" UInt16TypeStr = "uint16" UInt32TypeStr = "uint32" UInt64TypeStr = "uint64" Int8TypeStr = "int8" Int16TypeStr = "int16" Int32TypeStr = "int32" Int64TypeStr = "int64" )
const ( TrueHlc = "true" YesHlc = "yes" OnHlc = "on" FalseHlc = "false" NoHlc = "no" OffHlc = "off" )
common and global hlcs.
Variables ¶
This section is empty.
Functions ¶
func ToBoolType ¶
Types ¶
type EventArgs ¶
type EventArgs struct {
// contains filtered or unexported fields
}
func (*EventArgs) GetAsBool ¶
GetAsString will give you the boolean value of the flag with the specified name. if there is no flag with this name, or there is an error on our path, it will return you false.
func (*EventArgs) GetAsInteger ¶
GetAsString will give you the integer value of the flag with the specified name. if there is no flag with this name, or there is an error on our path, it will return you zero and false.
func (*EventArgs) GetAsString ¶
GetAsString will give you the string value of the flag with the specified name. if there is no flag with this name, or there is an error on our path, it will return you an empty string.
func (*EventArgs) GetAsStringOrRaw ¶
GetAsStringOrRaw will give you the string value of the flag with the specified name. if there is no flag with this name, or there is an error on our path, it will return you the raw data in the EventArgs struct.
func (*EventArgs) GetAsStringT ¶
GetAsStringT's functionality is exactly like GetAsString, but it will also trim the spaces, so you can use a pure string. please consider that using this method is somehow dangerous and the usage is for places like toLang in wotoTranslation package.
func (*EventArgs) GetAsStringTOrRaw ¶
GetAsStringTOrRaw's functionality is exactly like GetAsString, but it will also trim the spaces, so you can use a pure string. please consider that using this method is somehow dangerous and the usage is for places like toLang in wotoTranslation package. if the value is empty, it will return the raw data.
func (*EventArgs) GetCommand ¶
---------------------------------------------------------
func (*EventArgs) GetIndexFlag ¶
func (*EventArgs) HasFlag ¶
HasFlag will check if this EventArgs has at least one the provided flags or not. please notice that if you want to check if it has ALL of the flags, use `HasFlags` method.
func (*EventArgs) HasFlags ¶
HasFlag will check if this EventArgs has ALL of the provided flags or not. please notice that if you want to check if it has at least one of the flags, use `HasFlag` method.
func (*EventArgs) IsEmptyOrRaw ¶
type Flag ¶
type Flag struct {
// contains filtered or unexported fields
}
Flag is the options passed along with the commands by users. they should send them with prefex "--", but we will remove them in the argparser.
func (*Flag) GetAsInteger ¶
GetAsInteger will give the value of this flag as an int64 value. please notice that if it fails to convert the value to int64, it will return you zero and the second return value will be false.
func (*Flag) GetAsString ¶
GetAsString will give you the value as an string. for example if value is `true` (with flag type of `bool`), then the string will be "true". or if it's 10(an integer), it will give you: "10".
func (*Flag) GetType ¶
GetType will return the type of the value of this flag. please notice that if you don't enter any value for this flag, it will be considered as `true` (which is type bool).
func (*Flag) GetValue ¶
func (f *Flag) GetValue() interface{}
GetValue will return you the value of this flag. remember that value can be
func (*Flag) GetValueAndType ¶
type FlagType ¶
type FlagType uint8
const ( NoneFlagType FlagType = iota BoolFlagType FlagType = iota + 1 StringFlagType FlagType = iota + 2 UInt8FlagType FlagType = iota + 3 UInt16FlagType FlagType = iota + 4 UInt32FlagType FlagType = iota + 5 UInt64FlagType FlagType = iota + 6 Int8FlagType FlagType = iota + 7 Int16FlagType FlagType = iota + 8 Int32FlagType FlagType = iota + 9 Int64FlagType FlagType = iota + 10 )
type HlcCollection ¶
type HlcCollection []Hlc
func GetHlcCollection ¶
func GetHlcCollection(h ...Hlc) HlcCollection
func (*HlcCollection) Contains ¶
func (c *HlcCollection) Contains(name string) bool
func (*HlcCollection) GetValue ¶
func (c *HlcCollection) GetValue(name string) (interface{}, FlagType)