cmdutil

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: EUPL-1.2 Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextOrBackground

func ContextOrBackground() context.Context

ContextOrBackground returns the active CLI context when available.

Example

--- v0.9.0 generated usage examples ---

_ = ContextOrBackground()
core.Println("ContextOrBackground")
Output:
ContextOrBackground

func OptionBool

func OptionBool(opts core.Options, keys ...string) bool

OptionBool returns the parsed boolean value for the first matching key.

Example
_ = OptionBool(core.NewOptions())
core.Println("OptionBool")
Output:
OptionBool

func OptionBoolDefault

func OptionBoolDefault(opts core.Options, defaultValue bool, keys ...string) bool

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

func OptionHas(opts core.Options, keys ...string) bool

OptionHas reports whether any of the provided keys was supplied.

Example
_ = OptionHas(core.NewOptions())
core.Println("OptionHas")
Output:
OptionHas

func OptionString

func OptionString(opts core.Options, keys ...string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL