bufprint

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 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 {
	PrintOrganization(ctx context.Context, format Format, organization *registryv1alpha1.Organization) error
}

OrganizationPrinter is an organization printer.

func NewOrganizationPrinter

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

NewOrganizationPrinter returns a new OrganizationPrinter.

type PluginPrinter added in v0.45.0

type PluginPrinter interface {
	PrintPlugin(ctx context.Context, format Format, plugin *registryv1alpha1.Plugin) error
	PrintPlugins(ctx context.Context, format Format, nextPageToken string, plugins ...*registryv1alpha1.Plugin) error
}

PluginPrinter is a printer for plugins.

func NewPluginPrinter added in v0.45.0

func NewPluginPrinter(writer io.Writer) PluginPrinter

NewPluginPrinter returns a new PluginPrinter.

type PluginVersionPrinter added in v0.45.0

type PluginVersionPrinter interface {
	PrintPluginVersions(ctx context.Context, format Format, nextPageToken string, plugins ...*registryv1alpha1.PluginVersion) error
}

PluginVersionPrinter is a printer for PluginVersions.

func NewPluginVersionPrinter added in v0.45.0

func NewPluginVersionPrinter(writer io.Writer) PluginVersionPrinter

NewPluginVersionPrinter returns a new NewPluginVersionPrinter.

type RepositoryBranchPrinter

type RepositoryBranchPrinter interface {
	PrintRepositoryBranch(ctx context.Context, format Format, repositoryBranch *registryv1alpha1.RepositoryBranch) error
	PrintRepositoryBranches(ctx context.Context, format Format, nextPageToken string, repositoryBranches ...*registryv1alpha1.RepositoryBranch) error
}

RepositoryBranchPrinter is a repository branch printer.

func NewRepositoryBranchPrinter

func NewRepositoryBranchPrinter(writer io.Writer) RepositoryBranchPrinter

NewRepositoryBranchPrinter returns a new RepositoryBranchPrinter.

type RepositoryCommitPrinter added in v0.44.0

type RepositoryCommitPrinter interface {
	PrintRepositoryCommit(ctx context.Context, format Format, repositoryCommit *registryv1alpha1.RepositoryCommit) error
	PrintRepositoryCommits(ctx context.Context, format Format, nextPageToken string, repositoryCommits ...*registryv1alpha1.RepositoryCommit) error
}

RepositoryCommitPrinter is a repository commit printer.

func NewRepositoryCommitPrinter added in v0.44.0

func NewRepositoryCommitPrinter(writer io.Writer) RepositoryCommitPrinter

NewRepositoryCommitPrinter returns a new RepositoryCommitPrinter.

type RepositoryPrinter

type RepositoryPrinter interface {
	PrintRepository(ctx context.Context, format Format, repository *registryv1alpha1.Repository) error
	PrintRepositories(ctx context.Context, format Format, nextPageToken string, repositories ...*registryv1alpha1.Repository) error
}

RepositoryPrinter is a repository printer.

func NewRepositoryPrinter

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

NewRepositoryPrinter returns a new RepositoryPrinter.

type RepositoryTagPrinter added in v0.40.0

type RepositoryTagPrinter interface {
	PrintRepositoryTag(ctx context.Context, format Format, repositoryTag *registryv1alpha1.RepositoryTag) error
	PrintRepositoryTags(ctx context.Context, format Format, nextPageToken string, repositoryTags ...*registryv1alpha1.RepositoryTag) error
}

RepositoryTagPrinter is a repository tag printer.

func NewRepositoryTagPrinter added in v0.40.0

func NewRepositoryTagPrinter(writer io.Writer) RepositoryTagPrinter

NewRepositoryTagPrinter returns a new RepositoryTagPrinter.

type TabWriter

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

TabWriter is a tab writer.

type TemplatePrinter added in v0.45.0

type TemplatePrinter interface {
	PrintTemplate(ctx context.Context, format Format, plugin *registryv1alpha1.Template) error
	PrintTemplates(ctx context.Context, format Format, nextPageToken string, plugins ...*registryv1alpha1.Template) error
}

TemplatePrinter is a printer for Templates.

func NewTemplatePrinter added in v0.45.0

func NewTemplatePrinter(writer io.Writer) TemplatePrinter

NewTemplatePrinter returns a new NewTemplatePrinter.

type TemplateVersionPrinter added in v0.45.0

type TemplateVersionPrinter interface {
	PrintTemplateVersion(ctx context.Context, format Format, plugin *registryv1alpha1.TemplateVersion) error
	PrintTemplateVersions(ctx context.Context, format Format, nextPageToken string, plugins ...*registryv1alpha1.TemplateVersion) error
}

TemplateVersionPrinter is a printer for TemplateVersions.

func NewTemplateVersionPrinter added in v0.45.0

func NewTemplateVersionPrinter(writer io.Writer) TemplateVersionPrinter

NewTemplateVersionPrinter returns a new NewTemplateVersionPrinter.

Jump to

Keyboard shortcuts

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