Documentation
¶
Index ¶
- Variables
- func PrintEntity(writer io.Writer, format Format, entity Entity) error
- func PrintNames(writer io.Writer, format Format, entities ...Entity) error
- func PrintPage(writer io.Writer, format Format, nextPageToken string, nextPageCommand string, ...) error
- func WithTabWriter(writer io.Writer, header []string, f func(TabWriter) error) (retErr error)
- type CuratedPluginPrinter
- type Entity
- func NewCommitEntity(commit interface{ ... }, moduleFullName bufparse.FullName) Entity
- func NewLabelEntity(label interface{ ... }, moduleFullName bufparse.FullName) Entity
- func NewModuleEntity(module *modulev1.Module, moduleFullName bufparse.FullName) Entity
- func NewOrganizationEntity(organization *ownerv1.Organization, remote string) Entity
- func NewPluginEntity(plugin *pluginv1beta1.Plugin, pluginFullName bufparse.FullName) Entity
- func NewUserEntity(user *registryv1alpha1.User) Entity
- type Format
- type StatsPrinter
- type TabWriter
- type TokenPrinter
Constants ¶
This section is empty.
Variables ¶
var ( // AllFormatsString is the string representation of all Formats. AllFormatsString = stringutil.SliceToString([]string{FormatText.String(), FormatJSON.String()}) )
Functions ¶
func PrintEntity ¶ added in v1.39.0
PrintEntity prints an entity.
If format is FormatText, this prints the information in a table. If format is FormatJSON, this prints the information as a JSON object.
func PrintNames ¶ added in v1.39.0
PrintNames prints entities' names.
If format is FormatJSON, this also prints information about each entity, the same as calling PrintInfo on each entity.
Types ¶
type CuratedPluginPrinter ¶ added in v1.7.0
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 ¶ added in v1.7.0
func NewCuratedPluginPrinter(writer io.Writer) CuratedPluginPrinter
NewCuratedPluginPrinter returns a new CuratedPluginPrinter.
type Entity ¶ added in v1.39.0
type Entity interface {
// contains filtered or unexported methods
}
Entity is an entity printed structurally by functions in bufprint package. It's used in "buf registry" commands where the CLI prints a page of entities, such as commits, an entity's info or simply an entity's full name.
When printed by PrintEntity in text format, any field with a field tag in the form of `bufprint:"<field name>[,omitempty]"` is printed.
This means that an implementation of Entity must also be a struct.
func NewCommitEntity ¶ added in v1.39.0
func NewCommitEntity(commit interface { GetId() string GetCreateTime() *timestamppb.Timestamp }, moduleFullName bufparse.FullName) Entity
NewCommitEntity returns a new commit entity to print. It takes a commit as an interface to allow for modulev1.Commit and pluginv1beta1.Commit to be passed.
func NewLabelEntity ¶ added in v1.39.0
func NewLabelEntity(label interface { GetName() string GetCommitId() string GetCreateTime() *timestamppb.Timestamp GetArchiveTime() *timestamppb.Timestamp }, moduleFullName bufparse.FullName) Entity
NewLabelEntity returns a new label entity to print. It takes a label as an interface to allow for modulev1.Label and pluginv1beta1.Label to be passed.
func NewModuleEntity ¶ added in v1.39.0
NewModuleEntity returns a new module entity to print.
func NewOrganizationEntity ¶ added in v1.39.0
func NewOrganizationEntity(organization *ownerv1.Organization, remote string) Entity
NewOrganizationEntity returns a new organization entity to print.
func NewPluginEntity ¶ added in v1.48.0
func NewPluginEntity(plugin *pluginv1beta1.Plugin, pluginFullName bufparse.FullName) Entity
NewPluginEntity returns a new plugin entity to print.
func NewUserEntity ¶ added in v1.46.0
func NewUserEntity(user *registryv1alpha1.User) Entity
NewUserEntity returns a new user entity to print.
type Format ¶
type Format int
Format is a format to print.
func ParseFormat ¶
ParseFormat parses the format.
If the empty string is provided, this is interpreted as FormatText.
type StatsPrinter ¶ added in v1.17.0
type StatsPrinter interface {
PrintStats(ctx context.Context, format Format, stats *protostat.Stats) error
}
StatsPrinter is a printer of Stats.
func NewStatsPrinter ¶ added in v1.17.0
func NewStatsPrinter(writer io.Writer) StatsPrinter
NewStatsPrinter returns a new StatsPrinter.
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.