output

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 17 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(opts *Options, chain ProcessChain, fields ...string) *ComplexProcessingOutput

func (*ComplexProcessingOutput) Out

func (this *ComplexProcessingOutput) Out() error

type ElementOutput

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

func NewElementOutput

func NewElementOutput(opts *Options, 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(opts *Options, 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(opts *Options, 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 {
	Status  error
	Context Context
	// contains filtered or unexported fields
}

func NewManifestOutput added in v0.4.1

func NewManifestOutput(opts *Options) ManifestOutput

func (*ManifestOutput) Add

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

func (*ManifestOutput) Close

func (this *ManifestOutput) Close() error

func (*ManifestOutput) Out added in v0.4.1

func (this *ManifestOutput) Out() 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 Objects added in v0.4.1

type Objects = []Object

type Options

type Options struct {
	options.OptionSet

	Outputs          Outputs
	OutputMode       string
	Output           Output
	Sort             []string
	StatusCheck      StatusCheckFunction
	OptimizedColumns int
	FixedColums      int
	Context          clictx.Context // this context could be ocm context.
	Logging          logging.Context
	// contains filtered or unexported fields
}

func From

func OutputOptions

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

func (*Options) AdaptChain added in v0.4.1

func (o *Options) AdaptChain(errvar *error, chain processing.ProcessChain) processing.ProcessChain

func (*Options) AddFlags

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

func (*Options) CompleteAll

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

func (*Options) Configure added in v0.3.0

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) OptimizeColumns added in v0.4.1

func (o *Options) OptimizeColumns(n int) *Options

func (*Options) Options

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

func (*Options) Usage

func (o *Options) Usage() string

func (*Options) UseColumnOptimization added in v0.4.1

func (o *Options) UseColumnOptimization() bool

func (*Options) WithStatusCheck added in v0.4.1

func (o *Options) WithStatusCheck(f StatusCheckFunction) *Options

WithStatusCheck provides the possibility to check every entry to influence the final out status

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 StatusCheckFunction added in v0.4.1

type StatusCheckFunction func(opts *Options, e interface{}, old error) error

StatusCheckFunction manipulates the processing status error according to the state of the given entry.

type StringOutput

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

func NewStringOutput

func NewStringOutput(opts *Options, 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(opts *Options, 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