Documentation ¶
Index ¶
- Constants
- Variables
- func ArchiveStatusFlagToArchiveStatusFilter(archiveStatus string) (modulev1.ListLabelsRequest_ArchiveFilter, error)
- func BindArchiveStatus(flagSet *pflag.FlagSet, addr *string, flagName string)
- func BindAsFileDescriptorSet(flagSet *pflag.FlagSet, addr *bool, flagName string)
- func BindCreateVisibility(flagSet *pflag.FlagSet, addr *string, flagName string, createFlagName string)
- func BindDisableSymlinks(flagSet *pflag.FlagSet, addr *bool, flagName string)
- func BindExcludeImports(flagSet *pflag.FlagSet, addr *bool, flagName string)
- func BindExcludePaths(flagSet *pflag.FlagSet, excludePathsAddr *[]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 BindStringPointer(flagSet *pflag.FlagSet, name string, value **string, usage string)
- func BindVisibility(flagSet *pflag.FlagSet, addr *string, flagName string, emptyDefault bool)
- func BufYAMLFileExistsForDirPath(ctx context.Context, dirPath string) (bool, error)
- func GetBufWorkYAMLFileForDirPath(ctx context.Context, dirPath string) (bufconfig.BufWorkYAMLFile, error)
- func GetBufYAMLFileForDirPath(ctx context.Context, dirPath string) (bufconfig.BufYAMLFile, error)
- func GetBufYAMLFileForDirPathOrOverride(ctx context.Context, dirPath string, override string) (bufconfig.BufYAMLFile, error)
- func GetInputLong(inputArgDescription string) string
- func GetInputValue(container app.ArgContainer, inputHashtag string, defaultValue string) (string, error)
- func GetSourceDirLong(inputArgDescription string) string
- func GetSourceLong(inputArgDescription string) string
- func GetSourceOrModuleLong(inputArgDescription string) string
- func NewCommitProvider(container appext.Container) (bufmodule.CommitProvider, error)
- func NewConnectClientConfig(container appext.Container) (*connectclient.Config, error)
- func NewConnectClientConfigWithToken(container appext.Container, token string) (*connectclient.Config, error)
- func NewController(container appext.Container, options ...bufctl.ControllerOption) (bufctl.Controller, error)
- func NewGraphProvider(container appext.Container) (bufmodule.GraphProvider, error)
- func NewInvalidRemoteError(err error, remote string, moduleFullName string) error
- func NewLabelNameAlreadyExistsError(name string) error
- func NewLabelNotFoundError(moduleRef bufmodule.ModuleRef) error
- func NewModuleDataProvider(container appext.Container) (bufmodule.ModuleDataProvider, error)
- func NewModuleKeyProvider(container appext.Container) (bufmodule.ModuleKeyProvider, error)
- func NewModuleNameAlreadyExistsError(name string) error
- func NewModuleNotFoundError(name string) error
- func NewModuleRefNotFoundError(moduleRef bufmodule.ModuleRef) error
- func NewOrganizationNameAlreadyExistsError(name string) error
- func NewOrganizationNotFoundError(name string) error
- func NewOrganizationOrUserNotFoundError(name string) error
- func NewTokenNotFoundError(tokenID string) error
- func NewTooManyEmptyAnswersError(attempts int) error
- func NewUploader(container appext.Container) (bufmodule.Uploader, error)
- func PrintFileAnnotationSetLintConfigIgnoreYAMLV1(writer io.Writer, fileAnnotationSet bufanalysis.FileAnnotationSet) error
- func PrintRules(writer io.Writer, rules []bufcheck.Rule, format string, includeDeprecated bool) error
- func PromptUser(container app.Container, prompt string) (string, error)
- func PromptUserForDelete(container app.Container, entityType string, expectedAnswer string) error
- func PromptUserForPassword(container app.Container, prompt string) (string, error)
- func PutBufYAMLFileForDirPath(ctx context.Context, dirPath string, bufYAMLFile bufconfig.BufYAMLFile) error
- func ValidateErrorFormatFlagLint(errorFormatString string, errorFormatFlagName string) error
- func ValidateRequiredFlag[T comparable](flagName string, value T) error
- func VisibilityFlagToVisibilityAllowUnspecified(visibility string) (modulev1.ModuleVisibility, error)
- func WarnAlphaCommand(_ context.Context, container appext.Container)
- func WarnBetaCommand(_ context.Context, container appext.Container)
- type ModuleOwner
Constants ¶
const (
DefaultArchiveStatus = unarchivedArchiveStatus
)
const Version = "1.42.0"
Version is the CLI version of buf.
Variables ¶
var ( // ErrNotATTY is returned when an input io.Reader is not a TTY where it is expected. ErrNotATTY = errors.New("reader was not a TTY as expected") // ErrNoConfigFile is used when the user tries to execute a command without a configuration file. ErrNoConfigFile = errors.New(`no buf.yaml file discovered in the specified directory`) )
var ( // AllCacheModuleRelDirPaths are all directory paths for all time concerning the module cache. // // These are normalized. // These are relative to container.CacheDirPath(). // // This variable is used for clearing the cache. AllCacheModuleRelDirPaths = []string{ v1beta1CacheModuleDataRelDirPath, v1beta1CacheModuleLockRelDirPath, v1CacheModuleDataRelDirPath, v1CacheModuleLockRelDirPath, v1CacheModuleSumRelDirPath, v2CacheModuleRelDirPath, v3CacheModuleRelDirPath, v3CacheCommitsRelDirPath, v3CacheWKTRelDirPath, v3CacheModuleLockRelDirPath, } )
var AllLintFormatStrings = append( bufanalysis.AllFormatStrings, "config-ignore-yaml", )
AllLintFormatStrings are all format strings for lint.
var AllRuleFormatStrings = []string{
"text",
"json",
}
AllRuleFormatStrings is all rule format strings.
Functions ¶
func ArchiveStatusFlagToArchiveStatusFilter ¶ added in v1.33.0
func ArchiveStatusFlagToArchiveStatusFilter(archiveStatus string) (modulev1.ListLabelsRequest_ArchiveFilter, error)
ArchiveStatusFlagToArchiveStatusFilter parses the given string as a modulev1.ListLabelsRequest_ArchiveFilter.
func BindArchiveStatus ¶ added in v1.33.0
BindArchiveStatus binds the archive-status flag. Kept in this package so we can keep allArchiveStatusStrings private.
func BindAsFileDescriptorSet ¶
BindAsFileDescriptorSet binds the exclude-imports flag.
func BindCreateVisibility ¶ added in v1.19.0
func BindCreateVisibility(flagSet *pflag.FlagSet, addr *string, flagName string, createFlagName string)
BindCreateVisibility binds the create-visibility flag. Kept in this package so we can keep allVisibilityStrings private.
func BindDisableSymlinks ¶ added in v1.0.0
BindDisableSymlinks binds the disable-symlinks flag.
func BindExcludeImports ¶
BindExcludeImports binds the exclude-imports flag.
func BindExcludePaths ¶ added in v1.0.0
func BindExcludePaths( flagSet *pflag.FlagSet, excludePathsAddr *[]string, excludePathsFlagName string, )
BindExcludePaths binds the exclude-path 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 BindStringPointer ¶ added in v1.36.0
Binds a string pointer flag, which indicates flag presence, i.e. `--flag ""` is not the same as not passing the flag.
This is useful for buf registry organization/module update, where we only modify the fields specified.
Value must not be nil.
func BindVisibility ¶ added in v1.4.0
BindVisibility binds the visibility flag.
func BufYAMLFileExistsForDirPath ¶ added in v1.32.0
BufYAMLFileExistsForDirPath returns true if the buf.yaml file exists at the dir path.
func GetBufWorkYAMLFileForDirPath ¶ added in v1.34.0
func GetBufWorkYAMLFileForDirPath( ctx context.Context, dirPath string, ) (bufconfig.BufWorkYAMLFile, error)
GetBufWorkYAMLFileForDirPath gets the buf.work.yaml file for the directory path.
func GetBufYAMLFileForDirPath ¶ added in v1.32.0
func GetBufYAMLFileForDirPath( ctx context.Context, dirPath string, ) (bufconfig.BufYAMLFile, error)
GetBufYAMLFileForDirPath gets the buf.yaml file for the directory path.
func GetBufYAMLFileForDirPathOrOverride ¶ added in v1.32.0
func GetBufYAMLFileForDirPathOrOverride( ctx context.Context, dirPath string, override string, ) (bufconfig.BufYAMLFile, error)
GetBufYAMLFileForDirPathOrOverride get the buf.yaml file for either the usually-flag-based override, or if the override is not set, the directory path.
func GetInputLong ¶
GetInputLong gets the long command description for an input-based command.
func GetInputValue ¶
func GetInputValue( container app.ArgContainer, inputHashtag string, defaultValue string, ) (string, error)
GetInputValue gets the first arg.
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 GetSourceDirLong ¶ added in v1.7.0
GetSourceDirLong gets the long command description for a directory-based command.
func GetSourceLong ¶ added in v1.0.0
GetSourceLong gets the long command description for an input-based command.
func GetSourceOrModuleLong ¶
GetSourceOrModuleLong gets the long command description for an input-based command.
func NewCommitProvider ¶ added in v1.32.0
func NewCommitProvider(container appext.Container) (bufmodule.CommitProvider, error)
NewCommitProvider returns a new CommitProvider while creating the required cache directories.
func NewConnectClientConfig ¶ added in v1.10.0
func NewConnectClientConfig(container appext.Container) (*connectclient.Config, error)
NewConnectClientConfig creates a new connect.ClientConfig which uses a token reader to look up the token in the container or in netrc based on the address of each individual client. It is then set in the header of all outgoing requests from clients created using this config.
func NewConnectClientConfigWithToken ¶ added in v1.10.0
func NewConnectClientConfigWithToken(container appext.Container, token string) (*connectclient.Config, error)
NewConnectClientConfigWithToken creates a new connect.ClientConfig with a given token. The provided token is set in the header of all outgoing requests from this provider
func NewController ¶ added in v1.32.0
func NewController( container appext.Container, options ...bufctl.ControllerOption, ) (bufctl.Controller, error)
NewController returns a new Controller.
func NewGraphProvider ¶ added in v1.32.0
func NewGraphProvider(container appext.Container) (bufmodule.GraphProvider, error)
NewGraphProvider returns a new GraphProvider.
func NewInvalidRemoteError ¶ added in v1.27.0
NewInvalidRemoteError informs the user that the given remote is invalid.
func NewLabelNameAlreadyExistsError ¶ added in v1.33.0
NewLabelNameAlreadyExistsError informs the user that a label with that name already exists.
func NewLabelNotFoundError ¶ added in v1.33.0
NewLabelNotFoundError informs the user that a ModuleRef does not exist as a label.
func NewModuleDataProvider ¶ added in v1.32.0
func NewModuleDataProvider(container appext.Container) (bufmodule.ModuleDataProvider, error)
NewModuleDataProvider returns a new ModuleDataProvider while creating the required cache directories.
func NewModuleKeyProvider ¶ added in v1.32.0
func NewModuleKeyProvider(container appext.Container) (bufmodule.ModuleKeyProvider, error)
NewModuleKeyProvider returns a new ModuleKeyProvider.
func NewModuleNameAlreadyExistsError ¶ added in v1.36.0
NewModuleNameAlreadyExistsError informs the user that a module with that name already exists.
func NewModuleNotFoundError ¶ added in v1.36.0
NewModuleNotFoundError informs the user that a module with that name does not exist.
func NewModuleRefNotFoundError ¶ added in v1.32.0
NewModuleRefNotFoundError informs the user that a ModuleRef 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 NewOrganizationOrUserNotFoundError ¶ added in v1.33.0
NewOrganizationOrUserNotFoundError informs the user that an organization or user 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 NewUploader ¶ added in v1.32.0
NewUploader returns a new Uploader.
func PrintFileAnnotationSetLintConfigIgnoreYAMLV1 ¶ added in v1.40.0
func PrintFileAnnotationSetLintConfigIgnoreYAMLV1( writer io.Writer, fileAnnotationSet bufanalysis.FileAnnotationSet, ) error
PrintFileAnnotationSetLintConfigIgnoreYAMLV1 prints the FileAnnotationSet to the Writer for the lint config-ignore-yaml format.
TODO FUTURE: This is messed.
func PrintRules ¶ added in v1.37.0
func PrintRules(writer io.Writer, rules []bufcheck.Rule, format string, includeDeprecated bool) error
PrintRules prints the Rules to the writer given the --format and --include-deprecated flag values.
func PromptUser ¶
PromptUser reads a line from Stdin, prompting the user with the prompt first. The prompt is repeatedly shown until the user provides a non-empty response. ErrNotATTY is returned if the input containers Stdin is not a terminal.
func PromptUserForDelete ¶
PromptUserForDelete is used to receive user confirmation that a specific entity should be deleted. If the user's answer does not match the expected answer, an error is returned. ErrNotATTY is returned if the input containers Stdin is not a terminal.
func PromptUserForPassword ¶
PromptUserForPassword reads a line from Stdin, prompting the user with the prompt first. The prompt is repeatedly shown until the user provides a non-empty response. ErrNotATTY is returned if the input containers Stdin is not a terminal.
func PutBufYAMLFileForDirPath ¶ added in v1.32.0
func PutBufYAMLFileForDirPath( ctx context.Context, dirPath string, bufYAMLFile bufconfig.BufYAMLFile, ) error
PutBufYAMLFileForDirPath write the buf.yaml file to the directory path.
func ValidateErrorFormatFlagLint ¶
ValidateErrorFormatFlagLint validates the error format flag for lint.
func ValidateRequiredFlag ¶ added in v1.32.0
func ValidateRequiredFlag[T comparable](flagName string, value T) error
ValidateRequiredFlag validates that the required flag is set.
func VisibilityFlagToVisibilityAllowUnspecified ¶ added in v1.4.0
func VisibilityFlagToVisibilityAllowUnspecified(visibility string) (modulev1.ModuleVisibility, error)
VisibilityFlagToVisibilityAllowUnspecified parses the given string as a modulev1.ModuleVisibility where an empty string will be parsed as unspecified
func WarnAlphaCommand ¶ added in v1.0.0
WarnAlphaCommand prints a warning for a alpha command unless the alphaSuppressWarningsEnvKey environment variable is set.
Types ¶
type ModuleOwner ¶ added in v1.32.0
type ModuleOwner interface { // String returns "registry/owner". fmt.Stringer // Registry returns the hostname of the BSR instance that this owner is contained within. Registry() string // Owner returns the name of the user or organization. Owner() string // contains filtered or unexported methods }
ModuleOwner represents a module owner, consisting of a registry and owner.
This concept used to live in bufmodule but it doesn't really make sense there, as it isn't use anywhere else. We only use this in buf registry organization commands at the moment.
func NewModuleOwner ¶ added in v1.32.0
func NewModuleOwner( registry string, owner string, ) (ModuleOwner, error)
NewModuleOwner returns a new ModuleOwner for the given components.
func ParseModuleOwner ¶ added in v1.32.0
func ParseModuleOwner(moduleOwnerString string) (ModuleOwner, error)
ParseModuleOwner parses a ModuleOwner from a string in the form "registry/owner".