invocation

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capture

func Capture(opts Options) (*model.Invocation, error)

Capture builds an Invocation from the given options.

func ResolveComposeFiles

func ResolveComposeFiles(cwd string, files []string) []string

ResolveComposeFiles returns absolute compose file paths when possible.

Types

type EnvProvider

type EnvProvider interface {
	Environ() []string
	Getenv(key string) string
	Getwd() (string, error)
}

EnvProvider supplies process environment for capture (mockable).

type ExecGit

type ExecGit struct{}

ExecGit runs git via the shell.

func (ExecGit) Commit

func (ExecGit) Commit(cwd string) (string, error)

Commit returns HEAD.

func (ExecGit) Dirty

func (ExecGit) Dirty(cwd string) (bool, error)

Dirty reports whether the worktree has changes.

func (ExecGit) Root

func (ExecGit) Root(cwd string) (string, error)

Root returns the git toplevel directory.

type ExecVersions

type ExecVersions struct{}

ExecVersions runs docker / docker compose version commands.

func (ExecVersions) ComposeVersion

func (ExecVersions) ComposeVersion() (string, error)

ComposeVersion returns the Compose plugin version.

func (ExecVersions) DockerContext

func (ExecVersions) DockerContext() (string, error)

DockerContext returns the active docker context name.

func (ExecVersions) DockerVersion

func (ExecVersions) DockerVersion() (string, error)

DockerVersion returns the Docker server version.

type GitProvider

type GitProvider interface {
	Root(cwd string) (string, error)
	Commit(cwd string) (string, error)
	Dirty(cwd string) (bool, error)
}

GitProvider supplies git metadata (mockable).

type OSEnv

type OSEnv struct{}

OSEnv is the real process environment.

func (OSEnv) Environ

func (OSEnv) Environ() []string

Environ returns the process environment.

func (OSEnv) Getenv

func (OSEnv) Getenv(key string) string

Getenv returns one environment variable.

func (OSEnv) Getwd

func (OSEnv) Getwd() (string, error)

Getwd returns the working directory.

type Options

type Options struct {
	Command        []string
	IncludeEnvVals bool
	Env            EnvProvider
	Git            GitProvider
	Versions       VersionProvider
	Now            time.Time
}

Options controls Capture.

type VersionProvider

type VersionProvider interface {
	DockerVersion() (string, error)
	ComposeVersion() (string, error)
	DockerContext() (string, error)
}

VersionProvider supplies docker/compose versions (mockable).

Jump to

Keyboard shortcuts

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