package formatter
import "github.com/docker/compose/v2/cmd/formatter"
Index ¶
- Constants
- func NewLogConsumer(ctx context.Context, w io.Writer, color bool, prefix bool) api.LogConsumer
- func Print(toJSON interface{}, format string, outWriter io.Writer, writerFn func(w io.Writer), headers ...string) error
- func PrintPrettySection(out io.Writer, printer func(writer io.Writer), headers ...string) error
- func SetANSIMode(ansi string)
- func SetMultiErrorFormat(errs *multierror.Error)
- func ToJSON(i interface{}, prefix string, indentation string) (string, error)
- func ToStandardJSON(i interface{}) (string, error)
Constants ¶
const ( // Never use ANSI codes Never = "never" // Always use ANSI codes Always = "always" // Auto detect terminal is a tty and can use ANSI codes Auto = "auto" )
const ( // JSON is the constant for Json formats on list commands JSON = "json" // TemplateLegacyJSON the legacy json formatting value using go template TemplateLegacyJSON = "{{json.}}" // PRETTY is the constant for default formats on list commands PRETTY = "pretty" )
Functions ¶
func NewLogConsumer ¶
NewLogConsumer creates a new LogConsumer
func Print ¶
func Print(toJSON interface{}, format string, outWriter io.Writer, writerFn func(w io.Writer), headers ...string) error
Print prints formatted lists in different formats
func PrintPrettySection ¶
PrintPrettySection prints a tabbed section on the writer parameter
func SetANSIMode ¶
func SetANSIMode(ansi string)
SetANSIMode configure formatter for colored output on ANSI-compliant console
func SetMultiErrorFormat ¶
func SetMultiErrorFormat(errs *multierror.Error)
SetMultiErrorFormat set cli default format for multi-errors
func ToJSON ¶
ToJSON return a string with the JSON representation of the interface{}
func ToStandardJSON ¶
ToStandardJSON return a string with the JSON representation of the interface{}
Source Files ¶
colors.go consts.go formatter.go json.go logs.go multierrformat.go pretty.go
- Version
- v2.10.2
- Published
- Aug 26, 2022
- Platform
- js/wasm
- Imports
- 15 packages
- Last checked
- 6 minutes ago –
Tools for package owners.