Documentation
¶
Index ¶
- func ContextOrBackground() context.Context
- func OptionBool(opts core.Options, keys ...string) bool
- func OptionBoolDefault(opts core.Options, defaultValue bool, keys ...string) bool
- func OptionHas(opts core.Options, keys ...string) bool
- func OptionString(opts core.Options, keys ...string) string
- func ResultFromError(err error) core.Result
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextOrBackground ¶
ContextOrBackground returns the active CLI context when available.
Example ¶
--- v0.9.0 generated usage examples ---
_ = ContextOrBackground()
core.Println("ContextOrBackground")
Output: ContextOrBackground
func OptionBool ¶
OptionBool returns the parsed boolean value for the first matching key.
Example ¶
_ = OptionBool(core.NewOptions())
core.Println("OptionBool")
Output: OptionBool
func OptionBoolDefault ¶
OptionBoolDefault returns the parsed boolean value for the first matching key. Missing values fall back to defaultValue.
Example ¶
_ = OptionBoolDefault(core.NewOptions(), true)
core.Println("OptionBoolDefault")
Output: OptionBoolDefault
func OptionHas ¶
OptionHas reports whether any of the provided keys was supplied.
Example ¶
_ = OptionHas(core.NewOptions())
core.Println("OptionHas")
Output: OptionHas
func OptionString ¶
OptionString returns the first non-empty option value for the provided keys.
Example ¶
_ = OptionString(core.NewOptions())
core.Println("OptionString")
Output: OptionString
func ResultFromError ¶
func ResultFromError(err error) core.Result
ResultFromError adapts a Go error into a Core result.
Example ¶
_ = ResultFromError(nil)
core.Println("ResultFromError")
Output: ResultFromError
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.