Documentation ¶
Index ¶
- Constants
- Variables
- func BindAsFileDescriptorSet(flagSet *pflag.FlagSet, addr *bool, flagName string)
- func BindExcludeImports(flagSet *pflag.FlagSet, addr *bool, flagName string)
- func BindExcludeSourceInfo(flagSet *pflag.FlagSet, addr *bool, flagName string)
- func BindInputHashtag(flagSet *pflag.FlagSet, addr *string)
- func BindPaths(flagSet *pflag.FlagSet, pathsAddr *[]string, pathsFlagName string)
- func BindPathsAndDeprecatedFiles(flagSet *pflag.FlagSet, pathsAddr *[]string, pathsFlagName string, ...)
- func DeleteRemote(container appflag.Container, address string) (bool, error)
- func GetInputLong(inputArgDescription string) string
- func GetInputValue(container appflag.Container, inputHashtag string, deprecatedFlag string, ...) (string, error)
- func GetSourceOrModuleLong(inputArgDescription string) string
- func GetStringFlagOrDeprecatedFlag(flag string, flagName string, deprecatedFlag string, deprecatedFlagName string) (string, error)
- func GetStringSliceFlagOrDeprecatedFlag(flag []string, flagName string, deprecatedFlag []string, ...) ([]string, error)
- func NewBranchOrTagNameAlreadyExistsError(name string) error
- func NewConfig(container appflag.Container) (*bufapp.Config, error)
- func NewContextModifierProvider(container appflag.Container) func(string) (func(context.Context) context.Context, error)
- func NewErrorInterceptor() appflag.Interceptor
- func NewFetchImageReader(logger *zap.Logger, storageosProvider storageos.Provider) buffetch.ImageReader
- func NewFetchReader(logger *zap.Logger, storageosProvider storageos.Provider, ...) buffetch.Reader
- func NewFetchSourceReader(logger *zap.Logger, storageosProvider storageos.Provider) buffetch.SourceReader
- func NewFlagIsRequiredError(flagName string) error
- func NewInternalError(err error) error
- func NewModuleRefError(moduleRef string) error
- func NewModuleReferenceNotFoundError(reference bufmodule.ModuleReference) error
- func NewOrganizationNameAlreadyExistsError(name string) error
- func NewOrganizationNotFoundError(name string) error
- func NewRegistryProvider(ctx context.Context, container appflag.Container) (registryv1alpha1apiclient.Provider, error)
- func NewRepositoryNameAlreadyExistsError(name string) error
- func NewRepositoryNotFoundError(name string) error
- func NewTokenNotFoundError(tokenID string) error
- func NewTooManyEmptyAnswersError(attempts int) error
- func NewWireFileLister(logger *zap.Logger, storageosProvider storageos.Provider, ...) bufwire.FileLister
- func NewWireImageConfigReader(logger *zap.Logger, storageosProvider storageos.Provider, ...) bufwire.ImageConfigReader
- func NewWireImageReader(logger *zap.Logger, storageosProvider storageos.Provider) bufwire.ImageReader
- func NewWireImageWriter(logger *zap.Logger) bufwire.ImageWriter
- func NewWireModuleConfigReader(logger *zap.Logger, storageosProvider storageos.Provider, ...) bufwire.ModuleConfigReader
- func PrintOrganizations(ctx context.Context, address string, writer io.Writer, formatString string, ...) error
- func PrintRepositories(ctx context.Context, apiProvider registryv1alpha1apiclient.Provider, ...) error
- func PrintRepositoryBranches(ctx context.Context, writer io.Writer, formatString string, ...) error
- func PrintRepositoryTags(ctx context.Context, writer io.Writer, formatString string, ...) error
- func PrintUsers(ctx context.Context, writer io.Writer, formatString string, ...) error
- func PromptUserForDelete(container app.Container, entityType string, expectedAnswer string) error
- func ReadModule(ctx context.Context, container appflag.Container, ...) (bufmodule.Module, bufmodule.ModuleIdentity, error)
- func UpdateRemote(container appflag.Container, address string, token string) error
- type ModuleResolverReaderProvider
- type NopModuleResolverReaderProvider
Constants ¶
const ( // Version is the version of buf. Version = "0.44.0-dev" // FlagDeprecationMessageSuffix is the suffix for flag deprecation messages. FlagDeprecationMessageSuffix = ` We recommend migrating, however this flag continues to work. See https://docs.buf.build/faq for more details.` )
const ( // ExitCodeFileAnnotation is the exit code used when we print file annotations. // // We use a different exit code to be able to distinguish user-parsable errors from // system errors. ExitCodeFileAnnotation = 100 )
Variables ¶
var ( // ErrNoModuleName is used when the user does not specify a module name in their configuration file. ErrNoModuleName = errors.New(`please specify a module name in your configuration file with the "name" key`) // ErrNoConfigFile is used when the user tries to execute a command without a configuration file. ErrNoConfigFile = errors.New(`please define a configuration file in the current directory; you can create one by running "buf beta mod init"`) // ErrFileAnnotation is used when we print file annotations and want to return an error. // // The app package works on the concept that an error results in a non-zero exit // code, and we already print the messages with PrintFileAnnotations, so we do // not want to print any additional error message. // // We also exit with 100 to be able to distinguish user-parsable errors from // system errors. ErrFileAnnotation = app.NewError(ExitCodeFileAnnotation, "") )
Functions ¶
func BindAsFileDescriptorSet ¶
BindAsFileDescriptorSet binds the exclude-imports flag.
func BindExcludeImports ¶
BindExcludeImports binds the exclude-imports flag.
func BindExcludeSourceInfo ¶
BindExcludeSourceInfo binds the exclude-source-info flag.
func BindInputHashtag ¶
BindInputHashtag binds the input hashtag flag.
This needs to be added to any command that has the input as the first argument. This deals with the situation "buf build -#format=json" which results in a parse error from pflag.
func BindPathsAndDeprecatedFiles ¶
func BindPathsAndDeprecatedFiles( flagSet *pflag.FlagSet, pathsAddr *[]string, pathsFlagName string, filesAddr *[]string, filesFlagName string, )
BindPathAndDeprecatedFiles binds the paths flag and the deprecated files flag.
func DeleteRemote ¶
DeleteRemote deletes the user credentials from the user configuration.
func GetInputLong ¶
GetInputLong gets the long command description for an input-based command.
func GetInputValue ¶
func GetInputValue( container appflag.Container, inputHashtag string, deprecatedFlag string, deprecatedFlagName string, defaultValue string, ) (string, error)
GetInputValue gets either the first arg or the deprecated flag, but not both.
Also parses the special input hashtag flag that deals with the situation "buf build -#format=json". The existence of 0 or 1 args should be handled by the Args field on Command.
func GetSourceOrModuleLong ¶
GetSourceOrModuleLong gets the long command description for an input-based command.
func GetStringFlagOrDeprecatedFlag ¶
func GetStringFlagOrDeprecatedFlag( flag string, flagName string, deprecatedFlag string, deprecatedFlagName string, ) (string, error)
GetStringFlagOrDeprecatedFlag gets the flag, or the deprecated flag.
func GetStringSliceFlagOrDeprecatedFlag ¶
func GetStringSliceFlagOrDeprecatedFlag( flag []string, flagName string, deprecatedFlag []string, deprecatedFlagName string, ) ([]string, error)
GetStringSliceFlagOrDeprecatedFlag gets the flag, or the deprecated flag.
func NewBranchOrTagNameAlreadyExistsError ¶
NewBranchOrTagNameAlreadyExistsError informs the user that a branch or tag with that name already exists.
func NewContextModifierProvider ¶
func NewContextModifierProvider( container appflag.Container, ) func(string) (func(context.Context) context.Context, error)
NewContextModifierProvider returns a new context modifier provider for API providers.
Public for use in other packages that provide API provider constructors.
func NewErrorInterceptor ¶
func NewErrorInterceptor() appflag.Interceptor
NewErrorInterceptor returns a CLI interceptor that wraps Buf CLI errors.
func NewFetchImageReader ¶
func NewFetchImageReader( logger *zap.Logger, storageosProvider storageos.Provider, ) buffetch.ImageReader
NewFetchImageReader creates a new buffetch.ImageReader with the default HTTP client and git cloner.
func NewFetchReader ¶
func NewFetchReader( logger *zap.Logger, storageosProvider storageos.Provider, moduleResolver bufmodule.ModuleResolver, moduleReader bufmodule.ModuleReader, ) buffetch.Reader
NewFetchReader creates a new buffetch.Reader with the default HTTP client and git cloner.
func NewFetchSourceReader ¶
func NewFetchSourceReader( logger *zap.Logger, storageosProvider storageos.Provider, ) buffetch.SourceReader
NewFetchSourceReader creates a new buffetch.SourceReader with the default HTTP client and git cloner.
func NewFlagIsRequiredError ¶
NewFlagIsRequiredError informs the user that a given flag is required.
func NewInternalError ¶
NewInternalError represents an internal error encountered by the buf CLI. These errors should not happen and therefore warrant a bug report.
func NewModuleRefError ¶
NewModuleRefError is used when the client fails to parse a module ref.
func NewModuleReferenceNotFoundError ¶
func NewModuleReferenceNotFoundError(reference bufmodule.ModuleReference) error
NewModuleReferenceNotFoundError informs the user that a module reference does not exist.
func NewOrganizationNameAlreadyExistsError ¶
NewOrganizationNameAlreadyExistsError informs the user that an organization with that name already exists.
func NewOrganizationNotFoundError ¶
NewOrganizationNotFoundError informs the user that an organization with that name does not exist.
func NewRegistryProvider ¶
func NewRegistryProvider(ctx context.Context, container appflag.Container) (registryv1alpha1apiclient.Provider, error)
NewRegistryProvider creates a new registryv1alpha1apiclient.Provider.
func NewRepositoryNameAlreadyExistsError ¶
NewRepositoryNameAlreadyExistsError informs the user that a repository with that name already exists.
func NewRepositoryNotFoundError ¶
NewRepositoryNotFoundError informs the user that a repository with that name does not exist.
func NewTokenNotFoundError ¶
NewTokenNotFoundError informs the user that a token with that identifier does not exist.
func NewTooManyEmptyAnswersError ¶
NewTooManyEmptyAnswersError is used when the user does not answer a prompt in the given number of attempts.
func NewWireFileLister ¶
func NewWireFileLister( logger *zap.Logger, storageosProvider storageos.Provider, configProvider bufconfig.Provider, workspaceConfigProvider bufwork.Provider, moduleResolver bufmodule.ModuleResolver, moduleReader bufmodule.ModuleReader, ) bufwire.FileLister
NewWireFileLister returns a new FileLister.
func NewWireImageConfigReader ¶
func NewWireImageConfigReader( logger *zap.Logger, storageosProvider storageos.Provider, configProvider bufconfig.Provider, workspaceConfigProvider bufwork.Provider, moduleResolver bufmodule.ModuleResolver, moduleReader bufmodule.ModuleReader, ) bufwire.ImageConfigReader
NewWireImageConfigReader returns a new ImageConfigReader.
func NewWireImageReader ¶
func NewWireImageReader( logger *zap.Logger, storageosProvider storageos.Provider, ) bufwire.ImageReader
NewWireImageReader returns a new ImageReader.
func NewWireImageWriter ¶
func NewWireImageWriter( logger *zap.Logger, ) bufwire.ImageWriter
NewWireImageWriter returns a new ImageWriter.
func NewWireModuleConfigReader ¶
func NewWireModuleConfigReader( logger *zap.Logger, storageosProvider storageos.Provider, configProvider bufconfig.Provider, workspaceConfigProvider bufwork.Provider, moduleResolver bufmodule.ModuleResolver, moduleReader bufmodule.ModuleReader, ) bufwire.ModuleConfigReader
NewWireModuleConfigReader returns a new ModuleConfigReader.
func PrintOrganizations ¶
func PrintOrganizations( ctx context.Context, address string, writer io.Writer, formatString string, organizations ...*registryv1alpha1.Organization, ) error
PrintOrganizations prints the provided organizations to the writer.
func PrintRepositories ¶
func PrintRepositories( ctx context.Context, apiProvider registryv1alpha1apiclient.Provider, address string, writer io.Writer, formatString string, repositories ...*registryv1alpha1.Repository, ) error
PrintRepositories prints the provided repositories to the writer.
func PrintRepositoryBranches ¶
func PrintRepositoryBranches( ctx context.Context, writer io.Writer, formatString string, repositoryBranches ...*registryv1alpha1.RepositoryBranch, ) error
PrintRepositoryBranches prints the provided repositoryBranches to the writer.
func PrintRepositoryTags ¶
func PrintRepositoryTags( ctx context.Context, writer io.Writer, formatString string, repositoryTags ...*registryv1alpha1.RepositoryTag, ) error
PrintRepositoryTags prints the provided repositoryTags to the writer.
func PrintUsers ¶
func PrintUsers( ctx context.Context, writer io.Writer, formatString string, users ...*registryv1alpha1.User, ) error
PrintUsers prints the provided users to the writer.
func PromptUserForDelete ¶
PromptUserForDelete is used to receieve user confirmation that a specific entity should be deleted. If the user's answer does not match the expected answer, an error is returned.
Types ¶
type ModuleResolverReaderProvider ¶
type ModuleResolverReaderProvider interface { GetModuleReader(context.Context, appflag.Container) (bufmodule.ModuleReader, error) GetModuleResolver(context.Context, appflag.Container) (bufmodule.ModuleResolver, error) }
ModuleResolverReaderProvider provides ModuleResolvers and ModuleReaders.
func NewRegistryModuleResolverReaderProvider ¶
func NewRegistryModuleResolverReaderProvider() ModuleResolverReaderProvider
NewRegistryModuleResolverReaderProvider returns a new registry-backed ModuleResolverReaderProvider.
type NopModuleResolverReaderProvider ¶
type NopModuleResolverReaderProvider struct{}
NopModuleResolverReaderProvider is a no-op ModuleResolverReaderProvider.
func (NopModuleResolverReaderProvider) GetModuleReader ¶
func (NopModuleResolverReaderProvider) GetModuleReader(_ context.Context, _ appflag.Container) (bufmodule.ModuleReader, error)
GetModuleReader returns a no-op module reader.
func (NopModuleResolverReaderProvider) GetModuleResolver ¶
func (NopModuleResolverReaderProvider) GetModuleResolver(_ context.Context, _ appflag.Container) (bufmodule.ModuleResolver, error)
GetModuleResolver returns a no-op module resolver.