Documentation ¶
Overview ¶
Package output provides the ability for Vela to manage and manipulate the output rendered for a CLI action.
Usage:
import "github.com/go-vela/cli/internal/output"
Index ¶
- Constants
- func Dump(_input interface{}) error
- func Highlight(str string, lexer string, opts ColorOptions) string
- func JSON(_input interface{}, colorOpts ColorOptions) error
- func RawJSON(_input interface{}) error
- func Spew(_input interface{}) error
- func Stderr(_input interface{}) error
- func Stdout(_input interface{}) error
- func YAML(_input interface{}, colorOpts ColorOptions) error
- type ColorOptions
Constants ¶
const ( // DriverStdout defines the driver type // when outputting in stdout format. DriverStdout = "stdout" // DriverStderr defines the driver type // when outputting in stderr format. DriverStderr = "stderr" // DriverDump defines the driver type // when outputting in dump format. DriverDump = "dump" // DriverJSON defines the driver type // when outputting in JSON format. DriverJSON = "json" // DriverRawJSON defines the driver type // when outputting in raw JSON format. DriverRawJSON = "rawjson" // DriverSpew defines the driver type // when outputting in github.com/davecgh/go-spew/spew format. DriverSpew = "spew" // DriverYAML defines the driver type // when outputting in YAML format. DriverYAML = "yaml" )
output drivers.
Variables ¶
This section is empty.
Functions ¶
func Dump ¶
func Dump(_input interface{}) error
Dump outputs the provided input to stdout using github.com/davecgh/go-spew/spew to dump the input.
More Information:
Dump displays the passed parameters to standard out with newlines, customizable indentation, and additional debug information such as complete types and all pointer addresses used to indirect to the final value. It provides the following features over the built-in printing facilities provided by the fmt package:
- Pointers are dereferenced and followed
- Circular data structures are detected and handled properly
- Custom Stringer/error interfaces are optionally invoked, including on unexported types
- Custom types which only implement the Stringer/error interfaces via a pointer receiver are optionally invoked when passing non-pointer variables
- Byte arrays and slices are dumped like the hexdump -C command which includes offsets, byte values in hex, and ASCII output
func Highlight ¶ added in v0.24.0
func Highlight(str string, lexer string, opts ColorOptions) string
Highlight uses chroma to highlight the provided yaml string.
func JSON ¶
func JSON(_input interface{}, colorOpts ColorOptions) error
JSON parses the provided input and renders the parsed input in pretty JSON before outputting it to stdout.
func RawJSON ¶
func RawJSON(_input interface{}) error
RawJSON parses the provided input and renders the parsed input in raw JSON before outputting it to stdout.
func Spew ¶
func Spew(_input interface{}) error
Spew outputs the provided input to stdout using github.com/davecgh/go-spew/spew to verbosely print the input.
func Stderr ¶ added in v0.19.0
func Stderr(_input interface{}) error
Stderr outputs the provided input to stderr.
func YAML ¶
func YAML(_input interface{}, colorOpts ColorOptions) error
YAML parses the provided input and renders the parsed input in YAML before outputting it to stdout.
Types ¶
type ColorOptions ¶ added in v0.24.0
ColorOptions defines the output color options used for syntax highlighting.
func ColorOptionsFromCLIContext ¶ added in v0.24.0
func ColorOptionsFromCLIContext(c *cli.Context) ColorOptions
ColorOptionsFromCLIContext creates a ColorOptions from a CLI context.