context

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RealWorkDir

func RealWorkDir() (string, error)

Types

type Context

type Context interface {
	// Context is the golang context to use
	Context() context2.Context

	SetContext(ctx context2.Context)

	// WorkingDir is the current working dir. Functions
	// that receive this context should prefer this working directory
	// instead of using the global one.
	WorkingDir() string

	// RunID is the current Ankor CLI run id, which differs in each
	// run of the CLI. This can be used to save certain information
	// during the run.
	RunID() string

	// Environ is the environment for command execution
	Environ() expand.Environ

	// Log is the currently used logger
	Log() log.Logger

	// Config is the loaded Ankor config
	Config() config.Config

	// IsDone checks if the context expired
	IsDone() bool

	// ResolvePath resolves a relative path according to the
	// current working directory
	ResolvePath(relPath string) string

	WithNewTomb() (Context, *tomb2.Tomb)
	WithWorkingDir(workingDir string) Context
	WithConfig(conf config.Config) Context
	WithContext(ctx context2.Context) Context
	WithEnviron(environ expand.Environ) Context
	WithLogger(logger log.Logger) Context
	AttachGlobalFolders() Context

	RootFolders() *util.Dirs

	GetTemplateFs() embed.FS
	SetTemplateFs(templateFs embed.FS)

	GetVersion() string
	SetVersion(v string)

	SetOnline(online bool)
	GetOnline() bool
}

func NewContext

func NewContext(ctx context2.Context, log log.Logger) Context

type Runtime added in v0.3.0

type Runtime struct {
	Goos   string
	Goarch string
}

type Semver added in v0.3.0

type Semver struct {
	Major      uint64
	Minor      uint64
	Patch      uint64
	RawVersion string
	Prerelease string
}

Semver represents a semantic version.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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