Documentation ¶
Overview ¶
Package utils contains utility functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrFlagTagNotFound = errors.New("arg: given field doesn't have a `flag` tag") ErrStructFieldNotInitialized = errors.New("arg: given field is unitialized") )
Functions ¶
func GetArgumentFormOfStruct ¶
func GetArgumentFormOfStruct(strt interface{}) (flags []string)
Uses reflection to transform a struct containing fields with `flag` tags to a string slice of POSIX compliant long form arguments.
func GetFlagFormOfStruct ¶
func GetFlagFormOfStruct(strt interface{}) (flags []string)
func GetLongFlagFormOfField ¶
func GetLongFlagFormOfField(fieldValue reflect.Value, fieldType reflect.StructField) (string, error)
Uses reflection to retrieve the `flag` tag of a field. The value of the `flag` field with the value of the field is used to construct a POSIX long flag argument string.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.