util

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Yellow       = color.New(color.FgHiYellow, color.Bold).SprintFunc()
	YellowItalic = color.New(color.FgHiYellow, color.Bold, color.Italic).SprintFunc()
	Green        = color.New(color.FgHiGreen, color.Bold).SprintFunc()
	Blue         = color.New(color.FgHiBlue, color.Bold).SprintFunc()
	Cyan         = color.New(color.FgCyan, color.Bold, color.Underline).SprintFunc()
	Red          = color.New(color.FgHiRed, color.Bold).SprintFunc()
	White        = color.New(color.FgWhite).SprintFunc()
	WhiteBold    = color.New(color.FgWhite, color.Bold).SprintFunc()
)

Functions

func CheckErr

func CheckErr(err error)

CheckErr prints a user friendly error to STDERR

func IgnoreNotFoundErr

func IgnoreNotFoundErr(err error) error

func IsToTable

func IsToTable(printer *Printer) bool

IsToTable if printer output format want prilnt object detail,return false

func ToTable

func ToTable(tableRow TableRow, objs ...runtime.Object) (*metav1.Table, error)

ToTable runtime.Object convert metav1.Table to facilitate printing

func TranslateTimestampSince

func TranslateTimestampSince(timestamp metav1.Time) string

func UsageErrorf

func UsageErrorf(cmd *cobra.Command, format string, args ...interface{}) error

Types

type FakeRESTClientGetter

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

func NewFakeRESTClientGetter

func NewFakeRESTClientGetter(clientGetter genericclioptions.RESTClientGetter) *FakeRESTClientGetter

func (*FakeRESTClientGetter) ToDiscoveryClient

func (*FakeRESTClientGetter) ToRESTConfig

func (r *FakeRESTClientGetter) ToRESTConfig() (*restclient.Config, error)

func (*FakeRESTClientGetter) ToRESTMapper

func (r *FakeRESTClientGetter) ToRESTMapper() (meta.RESTMapper, error)

func (*FakeRESTClientGetter) ToRawKubeConfigLoader

func (r *FakeRESTClientGetter) ToRawKubeConfigLoader() clientcmd.ClientConfig

type Getter

type Getter interface {
	ToRESTConfig() (*restclient.Config, error)
	ToRESTMapper() (meta.RESTMapper, error)
	ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
	ToRawKubeConfigLoader() clientcmd.ClientConfig
}

type MessageLevel

type MessageLevel string

type Printer

type Printer struct {
	PrintFlags  *genericclioptions.PrintFlags
	PrinterFunc PrinterFunc

	ForceDetail bool
}

func NewPrinter

func NewPrinter(operation string, scheme *runtime.Scheme) *Printer

func (*Printer) AddFlags

func (p *Printer) AddFlags(cmd *cobra.Command)

func (*Printer) SetForceDefail

func (p *Printer) SetForceDefail()

func (*Printer) SetPrinterFunc

func (p *Printer) SetPrinterFunc(fc PrinterFunc)

func (*Printer) ShouldPrintObject

func (p *Printer) ShouldPrintObject() bool

func (*Printer) ToPrinter

func (p *Printer) ToPrinter() (printers.ResourcePrinter, error)

func (*Printer) ToPrinterWitchColumn

func (p *Printer) ToPrinterWitchColumn(columnLabels []string) (printers.ResourcePrinter, error)

type PrinterFunc

type PrinterFunc func(*Printer) (printers.ResourcePrinter, error)

func WithDefaultPrinter

func WithDefaultPrinter(operation string) PrinterFunc

func WithTablePrinter

func WithTablePrinter(options printers.PrintOptions) PrinterFunc

type RESTClientGetter

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

func NewRESTClientGetter

func NewRESTClientGetter(clientGetter genericclioptions.RESTClientGetter) *RESTClientGetter

func (*RESTClientGetter) ToDiscoveryClient

func (r *RESTClientGetter) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)

func (*RESTClientGetter) ToRESTConfig

func (r *RESTClientGetter) ToRESTConfig() (*restclient.Config, error)

func (*RESTClientGetter) ToRESTMapper

func (r *RESTClientGetter) ToRESTMapper() (meta.RESTMapper, error)

func (*RESTClientGetter) ToRawKubeConfigLoader

func (r *RESTClientGetter) ToRawKubeConfigLoader() clientcmd.ClientConfig

type TableRow

type TableRow func(obj interface{}) (metav1.TableRow, error)

type TaskInformer

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

TaskInformer is a printer of task information.

func NewTaskInformer

func NewTaskInformer(title string) *TaskInformer

func (*TaskInformer) AllDone

func (ti *TaskInformer) AllDone(t time.Duration) string

func (*TaskInformer) BeforeTask

func (ti *TaskInformer) BeforeTask(msg string) string

func (*TaskInformer) PrintTable

func (ti *TaskInformer) PrintTable(inventory map[string]string)

func (*TaskInformer) SkipTask

func (ti *TaskInformer) SkipTask(msg string) string

func (*TaskInformer) TaskFail

func (ti *TaskInformer) TaskFail(msg string) string

func (*TaskInformer) TaskFailWithTitle

func (ti *TaskInformer) TaskFailWithTitle(msg string) string

func (*TaskInformer) TaskInfo

func (ti *TaskInformer) TaskInfo(msg string) string

func (*TaskInformer) TaskSuccess

func (ti *TaskInformer) TaskSuccess() string

func (*TaskInformer) TipsOnOpenfunctionDemo

func (ti *TaskInformer) TipsOnOpenfunctionDemo(Endpoint string)

func (*TaskInformer) TipsOnUsingKnative

func (ti *TaskInformer) TipsOnUsingKnative()

Jump to

Keyboard shortcuts

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