printer

package
v1.0.0-beta.68 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 3 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 PrintFnResultInfo

func PrintFnResultInfo(ctx context.Context, resultsFile string, withNewLine bool)

PrintFnResultInfo displays information about the function results file.

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 kptfilev1.UniquePath
	// PkgDisplayPath is the display path for the package
	PkgDisplayPath kptfilev1.DisplayPath
	// PkgDisplayName is the display name of the package.
	// It takes precedence over PkgPath and PkgDisplayPath in most logging scenarios.
	PkgDisplayName string
}

Options are optional options for printer

func NewOpt

func NewOpt() *Options

NewOpt returns a pointer to new options

func (*Options) DisplayName

func (opt *Options) DisplayName(name string) *Options

DisplayName sets the package display name in options

func (*Options) DisplayPath

func (opt *Options) DisplayPath(p kptfilev1.DisplayPath) *Options

DisplayPath sets the package display path in options

func (*Options) Path

func (opt *Options) Path(p kptfilev1.UniquePath) *Options

Path sets the package unique path in options

type Printer

type Printer interface {
	PrintPackage(pkg *pkg.Pkg, leadingNewline bool)
	Printf(format string, args ...any)
	OptPrintf(opt *Options, format string, args ...any)
	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