bufprint

package
v0.43.3-0...-9926edd Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AllFormatsString is the string representation of all Formats.
	AllFormatsString = stringutil.SliceToString([]string{FormatText.String(), FormatJSON.String()})
)

Functions

func PrintProtoMessageJSON

func PrintProtoMessageJSON(writer io.Writer, message proto.Message) error

PrintProtoMessageJSON prints the Protobuf message as JSON.

Shared with internal packages.

func WithTabWriter

func WithTabWriter(
	writer io.Writer,
	header []string,
	f func(TabWriter) error,
) (retErr error)

WithTabWriter calls a function with a TabWriter.

Shared with internal packages.

Types

type Format

type Format int

Format is a format to print.

const (
	// FormatText is the text format.
	FormatText Format = 1
	// FormatJSON is the JSON format.
	FormatJSON Format = 2
)

func ParseFormat

func ParseFormat(s string) (Format, error)

ParseFormat parses the format.

If the empty string is provided, this is interpeted as FormatText.

func (Format) String

func (f Format) String() string

String implements fmt.Stringer.

type OrganizationPrinter

type OrganizationPrinter interface {
	PrintOrganizations(ctx context.Context, organizations ...*registryv1alpha1.Organization) error
}

OrganizationPrinter is an organization printer.

func NewOrganizationPrinter

func NewOrganizationPrinter(
	address string,
	writer io.Writer,
	format Format,
) (OrganizationPrinter, error)

NewOrganizationPrinter returns a new OrganizationPrinter.

type RepositoryBranchPrinter

type RepositoryBranchPrinter interface {
	PrintRepositoryBranches(ctx context.Context, repositoryBranches ...*registryv1alpha1.RepositoryBranch) error
}

RepositoryBranchPrinter is a repository branch printer.

func NewRepositoryBranchPrinter

func NewRepositoryBranchPrinter(writer io.Writer, format Format) (RepositoryBranchPrinter, error)

NewRepositoryBranchPrinter returns a new RepositoryBranchPrinter.

type RepositoryPrinter

type RepositoryPrinter interface {
	PrintRepositories(ctx context.Context, repositories ...*registryv1alpha1.Repository) error
}

RepositoryPrinter is a repository printer.

func NewRepositoryPrinter

func NewRepositoryPrinter(
	apiProvider registryv1alpha1apiclient.Provider,
	address string,
	writer io.Writer,
	format Format,
) (RepositoryPrinter, error)

NewRepositoryPrinter returns a new RepositoryPrinter.

type RepositoryTagPrinter

type RepositoryTagPrinter interface {
	PrintRepositoryTags(ctx context.Context, repositoryTags ...*registryv1alpha1.RepositoryTag) error
}

RepositoryTagPrinter is a repository tag printer.

func NewRepositoryTagPrinter

func NewRepositoryTagPrinter(writer io.Writer, format Format) (RepositoryTagPrinter, error)

NewRepositoryTagPrinter returns a new RepositoryTagPrinter.

type TabWriter

type TabWriter interface {
	Write(values ...string) error
}

TabWriter is a tab writer.

type UserPrinter

type UserPrinter interface {
	PrintUsers(ctx context.Context, users ...*registryv1alpha1.User) error
}

UserPrinter is a user printer.

func NewUserPrinter

func NewUserPrinter(writer io.Writer, format Format) (UserPrinter, error)

NewUserPrinter returns a new UserPrinter.

Jump to

Keyboard shortcuts

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