Documentation ¶
Index ¶
- Constants
- func Command() command
- func Confirmf(format string, a ...any) (bool, error)
- func ExitIfErrorf(err error, args ...interface{}) error
- func FailureMessagef(icon, format string, a ...any) string
- func InterpolateFlagPlaceholders(vars kong.Vars) func(*kong.Kong) error
- func MissingChildren(node *kong.Node) bool
- func NewSpinner(message, stopMessage string) (*yacspin.Spinner, error)
- func PrettyPrintObject(obj any, opts PrintOpts) error
- func PrettyPrintObjects[T any](objs []T, opts PrintOpts) error
- func PrintFailuref(icon, format string, a ...any)
- func PrintSuccessf(icon, format string, a ...any)
- func ProgressMessagef(icon, format string, a ...any) string
- func SuccessMessagef(icon, format string, a ...any) string
- type PrintOpts
Constants ¶
const ( LoginCommand = "auth login" LogoutCommand = "auth logout" SetOrgCommand = "auth set-org" )
const ( SuccessChar = "✓" FailureChar = "✗" )
Variables ¶
This section is empty.
Functions ¶
func Command ¶ added in v1.1.1
func Command() command
Command can be used to print how certain nctl commands can be executed
func Confirmf ¶
Confirmf prints a confirm dialog using format and then waits until prompt is confirmed or denied. Only y and yes are accepted for confirmation.
func ExitIfErrorf ¶ added in v1.2.0
ExitIfErrorf prints Usage + friendly message on error (and exits).
func FailureMessagef ¶
FailureMessagef is a formatted message for indicating a failed step.
func InterpolateFlagPlaceholders ¶ added in v1.2.0
InterpolateFlagPlaceholders will return a function which walks the whole kong model and interpolates variables in placeholders in flags.
func MissingChildren ¶ added in v1.2.0
MissingChildren detects missing commands/args. Logic taken from github.com/alecthomas/kong/context.go
func NewSpinner ¶
NewSpinner returns a new spinner with the default config
func PrettyPrintObject ¶ added in v1.2.2
PrettyPrintObject prints the supplied object in "pretty" colored yaml with some metadata, status and other default fields stripped out.
func PrettyPrintObjects ¶
PrettyPrintObjects prints the supplied objects in "pretty" colored yaml with some metadata, status and other default fields stripped out. If multiple objects are supplied, they will be divided with a yaml divider.
func PrintFailuref ¶
PrintFailuref prints a failure message.
func PrintSuccessf ¶
PrintSuccessf prints a success message.
func ProgressMessagef ¶
ProgressMessagef is a formatted message for use with a spinner.Suffix. An icon can be added which is displayed at the end of the message.
func SuccessMessagef ¶
SuccessMessagef is a formatted message for indicating a successful step.