Documentation ¶
Index ¶
- func AddOutputFlag(cmd *cobra.Command)
- func All(ctx context.Context, ps ...Printable)
- func DisplayJSONFormat() bool
- func DisplayVerbose() bool
- func Err(ctx context.Context, s ...any)
- func Errf(ctx context.Context, tmpl string, s ...any)
- func Info(ctx context.Context, s ...any)
- func Infof(ctx context.Context, t string, s ...any)
- func Item(ctx context.Context, p Printable)
- func ItemProperties(ctx context.Context, p Printable)
- func Only(ctx context.Context, e error) error
- func Out(ctx context.Context, s ...any)
- func Outf(ctx context.Context, t string, s ...any)
- func Pretty(ctx context.Context, a any)
- func PrettyJSON(ctx context.Context, p minimumPrintabler)
- func SetRootCmd(ctx context.Context, root *cobra.Command) context.Context
- func StderrWriter(ctx context.Context) io.Writer
- func Table(ctx context.Context, ps []Printable)
- type Printable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOutputFlag ¶
adds the persistent flag --output to the provided command.
func DisplayJSONFormat ¶
func DisplayJSONFormat() bool
DisplayJSONFormat returns true if the printer plans to output as json.
func DisplayVerbose ¶
func DisplayVerbose() bool
DisplayVerbose returns true if verbose output is enabled
func Err ¶
Err prints the params to cobra's error writer (stdErr by default) if s is nil, prints nothing.
func Errf ¶
Errf prints the params to cobra's error writer (stdErr by default) if s is nil, prints nothing. You should ideally be using SimpleError or OperationError.
func Info ¶
Info prints the params to cobra's error writer (stdErr by default) if s is nil, prints nothing.
func Infof ¶
Info prints the formatted strings to cobra's error writer (stdErr by default) if t is empty, prints nothing.
func ItemProperties ¶
ItemProperties prints the printable either as in a single line or a json The difference between this and Item is that this one does not print the ID
func Only ¶
Only tells the CLI to only display this error, preventing the usage (ie, help) menu from displaying as well.
func Out ¶
Out prints the params to cobra's output writer (stdOut by default) if s is nil, prints nothing.
func Outf ¶
Out prints the formatted strings to cobra's output writer (stdOut by default) if t is empty, prints nothing.
func PrettyJSON ¶
PrettyJSON prettifies and prints the value.
func SetRootCmd ¶
Adds a root cobra command to the context. Used to amend output controls like SilenceUsage or to retrieve the command's output writer.
func StderrWriter ¶
StderrWriter returns the stderr writer used in the root cmd. Returns nil if no root command is seeded.
Types ¶
type Printable ¶
type Printable interface { // should list the property names of the values surfaced in Values() Headers(skipID bool) []string // list of values for tabular or csv formatting // if the backing data is nil or otherwise missing, // values should provide an empty string as opposed to skipping entries Values(skipID bool) []string // contains filtered or unexported methods }