tools

package
v0.0.0-...-80c43d9 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureInstalled

func EnsureInstalled(ctx context.Context, tools ...ExternalTool) error

EnsureInstalled checks that all tools are installed, returning an error if one or more tools are not.

func ExecuteCommand

func ExecuteCommand(ctx context.Context, commandRunner exec.CommandRunner, cmd string, args ...string) (string, error)

func ExtractVersion

func ExtractVersion(cliOutput string) (semver.Version, error)

ExtractVersion extracts a major.minor.patch version number from a typical CLI version flag output.

minor and patch version numbers are both optional, treated as 0 if not found.

func WithInstalledCheckCache

func WithInstalledCheckCache(ctx context.Context) context.Context

Types

type ErrSemver

type ErrSemver struct {
	ToolName    string
	VersionInfo VersionInfo
}

func (*ErrSemver) Error

func (err *ErrSemver) Error() string

type ExecOptions

type ExecOptions struct {
	Interactive *bool
	StdOut      io.Writer
	UserPwsh    string
}

ExecOptions provide configuration for how scripts are executed

type ExternalTool

type ExternalTool interface {
	CheckInstalled(ctx context.Context) error
	InstallUrl() string
	Name() string
}

func Unique

func Unique(tools []ExternalTool) []ExternalTool

Unique filters a slice of tools such that a tool with a given name only appears once.

type MissingToolErrors

type MissingToolErrors struct {
	Errs      []error
	ToolNames []string
}

MissingToolErrors wraps a set of errors discovered when probing for tools and implements the Error interface to pretty print the underlying errors. We use this instead of the existing `multierr` package we use elsewhere, because we want to control the error string (the default one produced by multierr is not as nice as what we do here).

func (*MissingToolErrors) Error

func (m *MissingToolErrors) Error() string

type Script

type Script interface {
	Execute(ctx context.Context, scriptPath string, options ExecOptions) (exec.RunResult, error)
}

Utility to easily execute a bash script across platforms

type VersionInfo

type VersionInfo struct {
	MinimumVersion semver.Version
	UpdateCommand  string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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