scope

package
v0.1.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type ContentResolver

type ContentResolver interface {
	MultipleFileContentsByRef(f ...file.Reference) (map[file.Reference]string, error)
}

ContentResolver knows how to get content from file.References

type DirSource

type DirSource struct {
	Path string
}

type FileResolver

type FileResolver interface {
	FilesByPath(paths ...file.Path) ([]file.Reference, error)
	FilesByGlob(patterns ...string) ([]file.Reference, error)
}

FileResolver knows how to get file.References from string paths and globs

type ImageSource

type ImageSource struct {
	Img *image.Image
}

type Option

type Option int
const (
	UnknownScope Option = iota
	SquashedScope
	AllLayersScope
)

func ParseOption

func ParseOption(userStr string) Option

func (Option) String

func (o Option) String() string

type Resolver

type Resolver interface {
	ContentResolver
	FileResolver
}

type Scope

type Scope struct {
	Option Option

	ImgSrc ImageSource
	DirSrc DirSource
	// contains filtered or unexported fields
}

func NewScope

func NewScope(userInput string, o Option) (Scope, func(), error)

NewScope produces a Scope based on userInput like dir:// or image:tag

func NewScopeFromDir

func NewScopeFromDir(path string, option Option) (Scope, error)

func NewScopeFromImage

func NewScopeFromImage(img *image.Image, option Option) (Scope, error)

func (Scope) FilesByGlob

func (s Scope) FilesByGlob(patterns ...string) ([]file.Reference, error)

func (Scope) FilesByPath

func (s Scope) FilesByPath(paths ...file.Path) ([]file.Reference, error)

func (Scope) MultipleFileContentsByRef

func (s Scope) MultipleFileContentsByRef(f ...file.Reference) (map[file.Reference]string, error)

func (Scope) Source

func (s Scope) Source() interface{}

return either a dir source or img source

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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