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 ToolInPath(name string) error
- func WithInstalledCheckCache(ctx context.Context) context.Context
- type ErrSemver
- type ExecOptions
- type ExternalTool
- 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.
func ToolInPath ¶
toolInPath checks to see if a program can be found on the PATH, as exec.LookPath does, returns exec.ErrNotFound in the case where os.LookPath would return exec.ErrNotFound and other errors.
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 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 }