Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolFlagToCli ¶
func BoolFlagToCli(s Flag) interface{}
func BoolTFlagToCli ¶
func BoolTFlagToCli(s Flag) interface{}
func IntFlagToCli ¶
func IntFlagToCli(s Flag) interface{}
func StringFlagToCli ¶
func StringFlagToCli(s Flag) interface{}
func StringSliceFlagToCli ¶
func StringSliceFlagToCli(s Flag) interface{}
func UnmarshalFlags ¶ added in v0.0.7
UnmarshalFlags populates obj from the specified CLI context. By default, it will populate a struct field named "FooBar" with the contents of the flag "foo-bar". You can override this behavior and specify the flag name with the `omg:"flag-name"` struct tag.
Warning - UnmarshalFlags may zero-out any fields that were not specified in the context. If you want UnmarshalFlags to leave a field alone under all circumstances, then annotate it with the `omg:"-"` tag.
By default, UnmarshalFlags assumes that all fields in obj that are not explicitly skipped over with `omg:"-"` are required flags. It will return an error if a required flag is missing.
If a flag is not required and you don't want an error if it's missing, the flag can be annotated with `omg:"flag-name,optional"`. Note that the flag name is required in addition to 'optional' in this case.
Types ¶
type Flag ¶
func CreateBoolFlag ¶ added in v0.0.7
CreateBoolFlag creates a bool flag that is false by default.
func CreateBoolTFlag ¶ added in v0.0.7
CreateBoolTFlag creates a bool flag that is true by default.
func CreateIntFlag ¶ added in v0.0.7
CreateIntFlag creates an int flag with an optional default value.
func CreateStringFlag ¶ added in v0.0.7
CreateStringFlag creates a string flag with an optional default value.
func CreateStringSliceFlag ¶ added in v0.0.7
CreateStringSliceFlag creates a string slice flag with an optional default value.