Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInternalCustomPrettyFunc = errors.New("internal error: cli printer; please report this bug")
ErrInternalCustomPrettyFunc should be returned by a CustomPrettyFunc when some internal error occurs.
Functions ¶
This section is empty.
Types ¶
type CustomPrettyFunc ¶
CustomPrettyFunc is used to provide a custom function for pretty printing messages. The intent is to provide a migration pathway for pre-existing CLI code, such that this code can supply a custom pretty printer that mirrors its current behavior, but still be able to gain formatter functionality for other outputs.
type FormatterFlag ¶
type FormatterFlag struct {
// contains filtered or unexported fields
}
func AppendFlag ¶
AppendFlag adds the -format flag to the provided flagset, and populates the referenced Printer interface with a properly configured printer.
func AppendFlagWithCustomPretty ¶
func AppendFlagWithCustomPretty(p *Printer, fs *flag.FlagSet, env *commoncli.Env, cp CustomPrettyFunc) *FormatterFlag
AppendFlagWithCustomPretty is the same as AppendFlag, however it also allows a custom pretty function to be specified. A custom pretty function can be used to override the pretty print logic that normally ships with this package. Its intended use is to allow for the adoption of cliprinter while still retaining backwards compatibility with the legacy/bespoke pretty print output.
func (*FormatterFlag) Set ¶
func (f *FormatterFlag) Set(formatStr string) error
func (*FormatterFlag) String ¶
func (f *FormatterFlag) String() string