output

package
v2.0.0-...-98cc131 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fields

func Fields(fields ...interface{}) []string

Fields composes a (string) field list based on a sequence of strings and or field lists.

func FormatTable

func FormatTable(ctx Context, gap string, data [][]string)

func OutputModeCondition

func OutputModeCondition(opts *Options, mode string) options.Condition

func Print

func Print(list []Object, msg string, args ...interface{})

func SelectBest

func SelectBest(name string, candidates ...string) (string, int)

func Selected

func Selected(mode string) func(o options.OptionSetProvider) bool

Types

type AttrProcessingOutput

type AttrProcessingOutput struct {
	ElementOutput
	// contains filtered or unexported fields
}

func NewProcessingAttrOutput

func NewProcessingAttrOutput(opts *Options, chain ProcessChain, header ...string) *AttrProcessingOutput

func (*AttrProcessingOutput) Out

func (this *AttrProcessingOutput) Out() error

type AttributeSet

type AttributeSet struct {
	// contains filtered or unexported fields
}

func NewAttributeSet

func NewAttributeSet() *AttributeSet

func (*AttributeSet) Attribute

func (this *AttributeSet) Attribute(name, value string)

func (*AttributeSet) Attributef

func (this *AttributeSet) Attributef(name, f string, args ...interface{})

func (*AttributeSet) PrintAttributes

func (this *AttributeSet) PrintAttributes(ctx out.Context)

func (*AttributeSet) ResetAttributes

func (this *AttributeSet) ResetAttributes()

type ChainFunction

type ChainFunction func(opts *Options) processing.ProcessChain

func ComposeChain

func ComposeChain(funcs ...ChainFunction) ChainFunction

type ComplexProcessingOutput

type ComplexProcessingOutput struct {
	ElementOutput
	// contains filtered or unexported fields
}

func NewProcessingComplexOutput

func NewProcessingComplexOutput(log logging.Context, ctx Context, chain ProcessChain, fields ...string) *ComplexProcessingOutput

func (*ComplexProcessingOutput) Out

func (this *ComplexProcessingOutput) Out() error

type ElementOutput

type ElementOutput struct {
	Elems   data.Iterable
	Context Context
	// contains filtered or unexported fields
}

func NewElementOutput

func NewElementOutput(log logging.Context, ctx Context, chain ProcessChain) *ElementOutput

func (*ElementOutput) Add

func (this *ElementOutput) Add(e interface{}) error

func (*ElementOutput) Close

func (this *ElementOutput) Close() error

func (*ElementOutput) Out

func (this *ElementOutput) Out() error

type FunctionProcessingOutput

type FunctionProcessingOutput struct {
	ElementOutput
	// contains filtered or unexported fields
}

func NewProcessingFunctionOutput

func NewProcessingFunctionOutput(log logging.Context, ctx Context, chain ProcessChain, f OutputFunction) *FunctionProcessingOutput

func (*FunctionProcessingOutput) Out

func (this *FunctionProcessingOutput) Out() error

type ItemList

type ItemList struct {
	Items []interface{} `json:"items"`
}

type JSONOutput

type JSONOutput struct {
	ManifestOutput
	// contains filtered or unexported fields
}

func (*JSONOutput) Out

func (this *JSONOutput) Out() error

type JSONProcessingOutput

type JSONProcessingOutput struct {
	ElementOutput
	// contains filtered or unexported fields
}

func NewProcessingJSONOutput

func NewProcessingJSONOutput(log logging.Context, ctx Context, chain processing.ProcessChain, pretty bool) *JSONProcessingOutput

func (*JSONProcessingOutput) Out

func (this *JSONProcessingOutput) Out() error

type Manifest

type Manifest interface {
	AsManifest() interface{}
}

type ManifestOutput

type ManifestOutput struct {
	Context Context
	// contains filtered or unexported fields
}

func (*ManifestOutput) Add

func (this *ManifestOutput) Add(e interface{}) error

func (*ManifestOutput) Close

func (this *ManifestOutput) Close() error

type NopOutput

type NopOutput struct{}

func (NopOutput) Add

func (NopOutput) Add(e interface{}) error

func (NopOutput) Close

func (NopOutput) Close() error

func (NopOutput) Out

func (n NopOutput) Out() error

type Object

type Object = interface{}

type Options

type Options struct {
	options.OptionSet

	Outputs     Outputs
	OutputMode  string
	Output      Output
	Sort        []string
	FixedColums int
	Context     clictx.Context // this context could be ocm context.
	Logging     logging.Context
}

func From

func OutputOptions

func OutputOptions(outputs Outputs, opts ...options.Options) *Options

func (*Options) AddFlags

func (o *Options) AddFlags(fs *pflag.FlagSet)

func (*Options) CompleteAll

func (o *Options) CompleteAll(ctx clictx.Context) error

func (*Options) Configure

func (o *Options) Configure(ctx clictx.Context) error

func (*Options) Get

func (o *Options) Get(proto interface{}) bool

func (*Options) LogContext

func (o *Options) LogContext() logging.Context

func (*Options) Options

func (o *Options) Options(proto options.Options) interface{}

func (*Options) Usage

func (o *Options) Usage() string

type Output

type Output interface {
	Add(e interface{}) error
	Close() error
	Out() error
}

Output handles the output of elements. It consists of two phases: First, elements are added to the output using the Add method, This phase is finished calling the Close method. THis finalizes any ongoing input processing. Second, the final output is requested using the Out method.

type OutputFactory

type OutputFactory func(*Options) Output

type OutputFunction

type OutputFunction func(Context, interface{})

type Outputs

type Outputs map[string]OutputFactory

func NewOutputs

func NewOutputs(def OutputFactory, others ...Outputs) Outputs

func (Outputs) AddChainedManifestOutputs

func (this Outputs) AddChainedManifestOutputs(chain ChainFunction) Outputs

func (Outputs) AddManifestOutputs

func (this Outputs) AddManifestOutputs() Outputs

func (Outputs) Create

func (this Outputs) Create(opts *Options) (Output, error)

func (Outputs) Select

func (this Outputs) Select(name string) OutputFactory

type SingleElementOutput

type SingleElementOutput struct {
	Elem interface{}
}

func NewSingleElementOutput

func NewSingleElementOutput() *SingleElementOutput

func (*SingleElementOutput) Add

func (this *SingleElementOutput) Add(e interface{}) error

func (*SingleElementOutput) Close

func (this *SingleElementOutput) Close() error

func (*SingleElementOutput) Out

func (this *SingleElementOutput) Out() error

type SortFields

type SortFields interface {
	GetSortFields() []string
}

type StringOutput

type StringOutput struct {
	ElementOutput
	// contains filtered or unexported fields
}

func NewStringOutput

func NewStringOutput(log logging.Context, ctx Context, mapper processing.MappingFunction, linesep string) *StringOutput

func (*StringOutput) Out

func (this *StringOutput) Out() error

type TableOutput

type TableOutput struct {
	Headers []string
	Options *Options
	Chain   ProcessChain
	Mapping MappingFunction
}

func TreeOutput

func TreeOutput(t *TableOutput, header string, o ...TreeOutputOption) *TableOutput

func (*TableOutput) GetSortFields

func (this *TableOutput) GetSortFields() []string

func (*TableOutput) New

type TableProcessingOutput

type TableProcessingOutput struct {
	ElementOutput
	// contains filtered or unexported fields
}

func NewProcessingTableOutput

func NewProcessingTableOutput(opts *Options, chain ProcessChain, header ...string) *TableProcessingOutput

func (*TableProcessingOutput) GetSortFields

func (this *TableProcessingOutput) GetSortFields() []string

func (*TableProcessingOutput) Out

func (this *TableProcessingOutput) Out() error

type TreeNodeMappingFunc

type TreeNodeMappingFunc func(*tree.TreeObject) []string

func (TreeNodeMappingFunc) ApplyTreeOutputOption

func (f TreeNodeMappingFunc) ApplyTreeOutputOption(o *TreeOutputOptions)

type TreeNodeTitleFunc

type TreeNodeTitleFunc func(*tree.TreeObject) string

func (TreeNodeTitleFunc) ApplyTreeOutputOption

func (f TreeNodeTitleFunc) ApplyTreeOutputOption(o *TreeOutputOptions)

type TreeOutputOption

type TreeOutputOption interface {
	ApplyTreeOutputOption(*TreeOutputOptions)
}

type TreeOutputOptions

type TreeOutputOptions struct {
	// contains filtered or unexported fields
}

func (TreeOutputOptions) Apply

func (TreeOutputOptions) ApplyTreeOutputOption

func (o TreeOutputOptions) ApplyTreeOutputOption(opts *TreeOutputOptions)

func (TreeOutputOptions) NodeMapping

func (o TreeOutputOptions) NodeMapping(n int, obj *tree.TreeObject) interface{}

func (TreeOutputOptions) NodeTitle

func (o TreeOutputOptions) NodeTitle(obj *tree.TreeObject) string

type YAMLOutput

type YAMLOutput struct {
	ManifestOutput
}

func (*YAMLOutput) Out

func (this *YAMLOutput) Out() error

type YAMLProcessingOutput

type YAMLProcessingOutput struct {
	ElementOutput
}

func NewProcessingYAMLOutput

func NewProcessingYAMLOutput(log logging.Context, ctx Context, chain processing.ProcessChain) *YAMLProcessingOutput

func (*YAMLProcessingOutput) Out

func (this *YAMLProcessingOutput) Out() error

Jump to

Keyboard shortcuts

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