bufprint

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 18 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 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 CuratedPluginPrinter

type CuratedPluginPrinter interface {
	PrintCuratedPlugin(ctx context.Context, format Format, plugin *registryv1alpha1.CuratedPlugin) error
	PrintCuratedPlugins(ctx context.Context, format Format, nextPageToken string, plugins ...*registryv1alpha1.CuratedPlugin) error
}

CuratedPluginPrinter is a printer for curated plugins.

func NewCuratedPluginPrinter

func NewCuratedPluginPrinter(writer io.Writer) CuratedPluginPrinter

NewCuratedPluginPrinter returns a new CuratedPluginPrinter.

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 interpreted 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 RepositoryCommitPrinter

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

func NewRepositoryCommitPrinter(writer io.Writer) RepositoryCommitPrinter

NewRepositoryCommitPrinter returns a new RepositoryCommitPrinter.

type RepositoryDraftPrinter

type RepositoryDraftPrinter interface {
	PrintRepositoryDraft(ctx context.Context, format Format, repositoryCommit *registryv1alpha1.RepositoryCommit) error
	PrintRepositoryDrafts(ctx context.Context, format Format, nextPageToken string, repositoryCommits ...*registryv1alpha1.RepositoryCommit) error
}

RepositoryDraftPrinter is a repository draft printer.

func NewRepositoryDraftPrinter

func NewRepositoryDraftPrinter(writer io.Writer) RepositoryDraftPrinter

NewRepositoryDraftPrinter returns a new RepositoryDraftPrinter.

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(
	clientConfig *connectclient.Config,
	address string,
	writer io.Writer,
) RepositoryPrinter

NewRepositoryPrinter returns a new RepositoryPrinter.

type RepositoryTagPrinter

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

func NewRepositoryTagPrinter(writer io.Writer) RepositoryTagPrinter

NewRepositoryTagPrinter returns a new RepositoryTagPrinter.

type StatsPrinter

type StatsPrinter interface {
	PrintStats(ctx context.Context, format Format, stats *protostat.Stats) error
}

StatsPrinter is a printer of Stats.

func NewStatsPrinter

func NewStatsPrinter(writer io.Writer) StatsPrinter

NewStatsPrinter returns a new StatsPrinter.

type TabWriter

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

TabWriter is a tab writer.

type TokenPrinter

type TokenPrinter interface {
	PrintTokens(ctx context.Context, tokens ...*registryv1alpha1.Token) error
}

TokenPrinter is a token printer.

TODO: update to same format as other printers.

func NewTokenPrinter

func NewTokenPrinter(writer io.Writer, format Format) (TokenPrinter, error)

NewTokenPrinter returns a new TokenPrinter.

TODO: update to same format as other printers.

Jump to

Keyboard shortcuts

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