internal

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllFormatsToString

func AllFormatsToString() string

AllFormatsToString returns all format strings.

func ImageFormatsToString

func ImageFormatsToString() string

ImageFormatsToString returns image format strings.

func NewRelProtoFilePathResolver

func NewRelProtoFilePathResolver(
	dirPath string,
	chainedResolver bufbuild.ProtoFilePathResolver,
) (bufbuild.ProtoFilePathResolver, error)

NewRelProtoFilePathResolver returns a new ProtoFilePathResolver that will:

- Apply the chained resolver, if it is not nil. - Add the dirPath as a prefix. - Make the path relative to pwd if the path is relative, or return the path if it is absolute.

func SourceFormatsToString

func SourceFormatsToString() string

SourceFormatsToString returns source format strings.

Types

type ConfigOverrideParser

type ConfigOverrideParser interface {
	// ParseConfigOverride parses the config override.
	//
	// If the trimmed input is empty, this returns system error.
	ParseConfigOverride(value string) (*bufconfig.Config, error)
}

ConfigOverrideParser parses config overrides.

func NewConfigOverrideParser

func NewConfigOverrideParser(
	configProvider bufconfig.Provider,
	configOverrideFlagName string,
) ConfigOverrideParser

NewConfigOverrideParser returns a new ConfigOverrideParser.

type Format

type Format int

Format is a format.

const (
	// FormatDir is a format.
	FormatDir Format = 1
	// FormatTar is a format.
	FormatTar Format = 2
	// FormatTarGz is a format.
	FormatTarGz Format = 3
	// FormatGit is a format.
	FormatGit Format = 4
	// FormatBin is a format.
	FormatBin Format = 5
	// FormatBinGz is a format.
	FormatBinGz Format = 6
	// FormatJSON is a format.
	FormatJSON Format = 7
	// FormatJSONGz is a format.
	FormatJSONGz Format = 8
)

func (Format) IsImage

func (f Format) IsImage() bool

IsImage returns true if f represents a image type.

Images are alway files

func (Format) IsSource

func (f Format) IsSource() bool

IsSource returns true if f represents a source type.

func (Format) String

func (f Format) String() string

String returns the string value of f.

type InputRef

type InputRef struct {
	// Format is the format of the input.
	// Required.
	Format Format
	// Path is the path of the input.
	// The special value "-" indicates stdin or stdout.
	// If this is "-", Format == FormatTar, FormatTarGz, FormatBin, FormatBinGz, FormatJSON, FormatJSONGz.
	// Required.
	Path string

	// GitBranch is the branch of the git repository.
	// This will only be set if Format == FormatGit.
	// Optional regardless.
	GitBranch string
	// StripComponents is the number of components to strip from a tarball.
	// This will only be set if Format == FormatTar, FormatTarGz
	StripComponents uint32
}

InputRef is a parsed input reference.

type InputRefParser

type InputRefParser interface {
	// ParseInputRef parses the InputRef from the value.
	//
	// Value should always be non-empty - if you want this to be ".", specify it.
	// If onlySources is true, the Format will only be FormatDir, FormatTar, FormatTarGz, FormatGit.
	// If onlyImages is true, the Format will only be FormatBin, FormatBinGz, FormatJSON, FormatJSONGz.
	// If onlySources and onlyImages is true, this returns system error.
	// Format will be valid and only one of these eight types.
	ParseInputRef(value string, onlySources bool, onlyImages bool) (*InputRef, error)
}

InputRefParser parses InputRefs.

func NewInputRefParser

func NewInputRefParser(valueFlagName string) InputRefParser

NewInputRefParser returns a new InputRefParser.

Jump to

Keyboard shortcuts

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