format

package
v0.9.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AvailableFormats = []Format{
	JSONFormat,
	TableFormat,
}

AvailableFormats is a list of presenter format options available to users.

Functions

func GetPresenter added in v0.9.0

func GetPresenter(format Format, pb models.PresenterConfig) presenter.Presenter

GetPresenter retrieves a Presenter that matches a CLI option

func Tprintf

func Tprintf(tmpl string, data map[string]interface{}) string

Tprintf renders a string from a given template string and field values

Types

type Format added in v0.9.0

type Format string

Format is a dedicated type to represent a specific kind of presenter output format.

const (
	UnknownFormat Format = "unknown"
	JSONFormat    Format = "json"
	TableFormat   Format = "table"
)

func Parse added in v0.9.0

func Parse(userInput string) Format

Parse returns the presenter.format specified by the given user input.

func (Format) String added in v0.9.0

func (f Format) String() string

type ScanResultWriter added in v0.9.0

type ScanResultWriter interface {
	Write(result models.PresenterConfig) error
}

func MakeScanResultWriter added in v0.9.0

func MakeScanResultWriter(outputs []string, defaultFile string) (ScanResultWriter, error)

MakeScanResultWriter creates a ScanResultWriter for output or returns an error. this will either return a valid writer or an error but neither both and if there is no error, ScanResultWriter.Close() should be called

func MakeScanResultWriterForFormat added in v0.9.0

func MakeScanResultWriterForFormat(f string, path string) (ScanResultWriter, error)

MakeScanResultWriterForFormat creates a ScanResultWriter for the given format or returns an error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL