Help us shape the future of Go! Take the 2026 Go Developer Survey

printer

package
v0.78.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ColorBold       = color.New(color.Bold)
	ColorGreenBold  = color.New(color.FgGreen).Add(color.Bold)
	ColorYellowBold = color.New(color.FgYellow).Add(color.Bold)
	ColorRedBold    = color.New(color.FgRed).Add(color.Bold)
)

Functions

This section is empty.

Types

type Format

type Format int
const (
	FormatUnspecified Format = iota
	FormatHuman
	FormatJSON
	FormatCSV
)

func (*Format) Set added in v0.41.0

func (f *Format) Set(s string) error

func (Format) String added in v0.41.0

func (f Format) String() string

func (*Format) Type

func (f *Format) Type() string

type Printer

type Printer struct {
	Format Format
	// contains filtered or unexported fields
}

Printer is a helper for printing output in a specific format. It differentiates between human-readable and machine-readable output. Regular log messages are always produced as human-readable output. Human-readable output is discarded when the format is not FormatHuman.

func NewPrinter

func NewPrinter(format Format) *Printer

func (*Printer) FormatBytes added in v0.78.0

func (p *Printer) FormatBytes(bytes int64) string

FormatBytes converts bytes to human readable format

func (*Printer) FormatNumber added in v0.78.0

func (p *Printer) FormatNumber(num int64) string

FormatNumber formats a number with appropriate suffix (K, M, B, etc.)

func (*Printer) FormatValue added in v0.78.0

func (p *Printer) FormatValue(val interface{}) string

FormatValue formats a value for display, avoiding scientific notation for numbers

func (*Printer) OverrideDataOutput added in v0.42.0

func (p *Printer) OverrideDataOutput(out io.Writer)

func (*Printer) OverrideHumanOutput added in v0.42.0

func (p *Printer) OverrideHumanOutput(out io.Writer)

func (*Printer) Print

func (p *Printer) Print(i ...interface{})

func (*Printer) PrintBillingIssues added in v0.50.0

func (p *Printer) PrintBillingIssues(errs []*adminv1.BillingIssue)

func (*Printer) PrintData added in v0.42.0

func (p *Printer) PrintData(v interface{})

func (*Printer) PrintDataWithTitle added in v0.46.0

func (p *Printer) PrintDataWithTitle(v interface{}, title string)

func (*Printer) PrintMagicAuthTokens added in v0.47.0

func (p *Printer) PrintMagicAuthTokens(tkns []*adminv1.MagicAuthToken)

func (*Printer) PrintMemberUsergroups added in v0.47.2

func (p *Printer) PrintMemberUsergroups(members []*adminv1.MemberUsergroup)

func (*Printer) PrintModelPartitions added in v0.51.0

func (p *Printer) PrintModelPartitions(partitions []*runtimev1.ModelPartition)

func (*Printer) PrintOrganizationInvites added in v0.62.0

func (p *Printer) PrintOrganizationInvites(invites []*adminv1.OrganizationInvite)

func (*Printer) PrintOrganizationMemberServices added in v0.78.0

func (p *Printer) PrintOrganizationMemberServices(members []*adminv1.OrganizationMemberService)

func (*Printer) PrintOrganizationMemberUsers added in v0.58.0

func (p *Printer) PrintOrganizationMemberUsers(members []*adminv1.OrganizationMemberUser)

func (*Printer) PrintOrgs added in v0.42.0

func (p *Printer) PrintOrgs(orgs []*adminv1.Organization, defaultOrg string)

func (*Printer) PrintPlans added in v0.47.0

func (p *Printer) PrintPlans(plans []*adminv1.BillingPlan)

func (*Printer) PrintProjectInvites added in v0.62.0

func (p *Printer) PrintProjectInvites(invites []*adminv1.ProjectInvite)

func (*Printer) PrintProjectMemberServices added in v0.78.0

func (p *Printer) PrintProjectMemberServices(members []*adminv1.ProjectMemberService)

func (*Printer) PrintProjectMemberUsers added in v0.58.0

func (p *Printer) PrintProjectMemberUsers(members []*adminv1.ProjectMemberUser)

func (*Printer) PrintProjects added in v0.42.0

func (p *Printer) PrintProjects(projs []*adminv1.Project)

func (*Printer) PrintQueryResponse added in v0.56.0

func (p *Printer) PrintQueryResponse(res *runtimev1.QueryResolverResponse)

PrintQueryResponse prints the query response in the desired format (human, json, csv)

func (*Printer) PrintServiceTokens added in v0.42.0

func (p *Printer) PrintServiceTokens(sts []*adminv1.ServiceToken)

func (*Printer) PrintServices added in v0.42.0

func (p *Printer) PrintServices(svcs []*adminv1.Service)

func (*Printer) PrintSubscriptions added in v0.47.0

func (p *Printer) PrintSubscriptions(subs []*adminv1.Subscription)

func (*Printer) PrintUserTokens added in v0.64.1

func (p *Printer) PrintUserTokens(uts []*adminv1.UserAuthToken)

func (*Printer) PrintUsergroupMemberUsers added in v0.58.0

func (p *Printer) PrintUsergroupMemberUsers(members []*adminv1.UsergroupMemberUser)

func (*Printer) PrintUsers added in v0.42.0

func (p *Printer) PrintUsers(users []*adminv1.User)

func (*Printer) Printf

func (p *Printer) Printf(format string, i ...interface{})

func (*Printer) PrintfBold added in v0.42.0

func (p *Printer) PrintfBold(str string, i ...interface{})

func (*Printer) PrintfError added in v0.42.0

func (p *Printer) PrintfError(str string, i ...interface{})

func (*Printer) PrintfSuccess added in v0.42.0

func (p *Printer) PrintfSuccess(str string, i ...interface{})

func (*Printer) PrintfWarn added in v0.42.0

func (p *Printer) PrintfWarn(str string, i ...interface{})

func (*Printer) Println

func (p *Printer) Println(i ...interface{})

Jump to

Keyboard shortcuts

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