printer

package
v1.0.0-beta.11 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package printer defines utilities to display kpt CLI output.

Index

Constants

This section is empty.

Variables

View Source
var TruncateOutput bool

TruncateOutput defines should output be truncated

Functions

func WithContext

func WithContext(ctx context.Context, pr Printer) context.Context

WithContext creates new context from the given parent context by setting the printer instance.

Types

type Options

type Options struct {
	// PkgPath is the unique path to the package
	PkgPath types.UniquePath
	// PkgDisplayPath is the display path for the package
	PkgDisplayPath types.DisplayPath
}

Options are optional options for printer

func NewOpt

func NewOpt() *Options

NewOpt returns a pointer to new options

func (*Options) Pkg

func (opt *Options) Pkg(p types.UniquePath) *Options

Pkg sets the package unique path in options

func (*Options) PkgDisplay

func (opt *Options) PkgDisplay(p types.DisplayPath) *Options

PkgDisplayPath sets the package display path in options

type Printer

type Printer interface {
	PrintPackage(pkg *pkg.Pkg, leadingNewline bool)
	Printf(format string, args ...interface{})
	OptPrintf(opt *Options, format string, args ...interface{})
	OutStream() io.Writer
	ErrStream() io.Writer
}

Printer defines capabilities to display content in kpt CLI. The main intention, at the moment, is to abstract away printing output in the CLI so that we can evolve the kpt CLI UX.

func FromContextOrDie

func FromContextOrDie(ctx context.Context) Printer

FromContext returns printer instance associated with the context.

func New

func New(outStream, errStream io.Writer) Printer

New returns an instance of Printer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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