printer

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Copyright Contributors to the Open Cluster Management project

Copyright Contributors to the Open Cluster Management project

Index

Constants

View Source
const (
	LEVEL_0 = iota
	LEVEL_1
	LEVEL_2
	LEVEL_3
	LEVEL_4
)

Each level has 2 spaces for PrefixWriter

Variables

This section is empty.

Functions

func DefaultIterFunc added in v0.4.0

func DefaultIterFunc(key string, value interface{}) error

func DefaultSegmenter added in v0.4.0

func DefaultSegmenter(path string, start int) (segment string, next int)

func GetSpinnerKlusterletStatus added in v0.7.0

func GetSpinnerKlusterletStatus(kl *operatorv1.Klusterlet) string

func GetSpinnerPodStatus

func GetSpinnerPodStatus(pod *corev1.Pod) string

func NewSpinner

func NewSpinner(suffix string, interval time.Duration) *spinner.Spinner

func NewSpinnerWithStatus

func NewSpinnerWithStatus(suffix string, interval time.Duration, final string, statusFunc func() string) *spinner.Spinner

func PrintComponentsCRD added in v0.2.0

func PrintComponentsCRD(printer PrefixWriter, crdClient clientset.Interface, resource []operatorv1.RelatedResourceMeta) error

func PrintComponentsDeploy added in v0.2.0

func PrintComponentsDeploy(printer PrefixWriter, deployClient kubernetes.Interface, resource []operatorv1.RelatedResourceMeta, name string) error

func PrintOperatorCRD added in v0.4.0

func PrintOperatorCRD(printer PrefixWriter, crdClient clientset.Interface, name string) error

func WorkDetails added in v0.6.0

func WorkDetails(keyPrefix string, work *workapiv1.ManifestWork) map[string]any

Types

type IterFunc added in v0.4.0

type IterFunc func(key string, value interface{}) error

type PrefixWriter

type PrefixWriter interface {
	// Write writes text with the specified indentation level.
	Write(level int, format string, a ...interface{})
	// WriteLine writes an entire line with no indentation level.
	WriteLine(a ...interface{})
	// Flush forces indentation to be reset.
	Flush()
}

PrefixWriter can write text at various indentation levels.

func NewPrefixWriter

func NewPrefixWriter(out io.Writer) PrefixWriter

NewPrefixWriter creates a new PrefixWriter.

type PrinterOption added in v0.4.0

type PrinterOption struct {
	Options printers.PrintOptions
	Format  string
	// contains filtered or unexported fields
}

func NewPrinterOption added in v0.4.0

func NewPrinterOption(o printers.PrintOptions) *PrinterOption

func (*PrinterOption) AddFlag added in v0.4.0

func (p *PrinterOption) AddFlag(fs *pflag.FlagSet)

func (*PrinterOption) Competele added in v0.4.0

func (p *PrinterOption) Competele()

func (*PrinterOption) Print added in v0.4.0

func (*PrinterOption) Validate added in v0.4.0

func (p *PrinterOption) Validate() error

func (*PrinterOption) WithTableConverter added in v0.4.0

func (p *PrinterOption) WithTableConverter(f func(runtime.Object) *metav1.Table) *PrinterOption

func (*PrinterOption) WithTreeConverter added in v0.4.0

func (p *PrinterOption) WithTreeConverter(f func(runtime.Object, *TreePrinter) *TreePrinter) *PrinterOption

type Segmenter added in v0.4.0

type Segmenter func(key string, start int) (segment string, nextIndex int)

type TreePrinter added in v0.4.0

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

func NewTreePrinter added in v0.4.0

func NewTreePrinter(name string) TreePrinter

func (*TreePrinter) AddFileds added in v0.4.0

func (t *TreePrinter) AddFileds(name string, mp *map[string]interface{})

AddFileds add the fileds need to print to TreePrinter. @param name : the name of object to be print @param mp : key is a string represents level and path, value is the value will be printed.

func (*TreePrinter) Print added in v0.4.0

func (t *TreePrinter) Print(outstream io.Writer) error

type Trie added in v0.4.0

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

func NewTrie added in v0.4.0

func NewTrie(sgmt Segmenter) *Trie

func (*Trie) Get added in v0.4.0

func (trie *Trie) Get(key string) interface{}

func (*Trie) Iter added in v0.4.0

func (trie *Trie) Iter(it IterFunc) error

func (*Trie) Put added in v0.4.0

func (trie *Trie) Put(key string, value interface{}) bool

type Trier added in v0.4.0

type Trier interface {
	Get(key string) interface{}
	Put(key string, value interface{}) bool
	Iter(it IterFunc) error
}

Jump to

Keyboard shortcuts

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