Documentation
¶
Index ¶
- func EnsureInstalled(ctx context.Context, tools ...ExternalTool) error
- func ExecuteCommand(ctx context.Context, commandRunner exec.CommandRunner, cmd string, ...) (string, error)
- func ExtractVersion(cliOutput string) (semver.Version, error)
- func WithInstalledCheckCache(ctx context.Context) context.Context
- type ErrSemver
- type ExecOptions
- type ExternalTool
- type MissingToolErrors
- type Script
- type VersionInfo
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 ExtractVersion ¶
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.
Types ¶
type ErrSemver ¶
type ErrSemver struct {
ToolName string
VersionInfo VersionInfo
}
type ExecOptions ¶
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 ¶
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