tools

package
v0.29.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadToFolder

func DownloadToFolder(filepath string) error

DownloadToFolder creates a folder and a file, uses the ORAS client to copy from the remote repository to the file, and makes the file executable by everyone. An error is returned if any of these steps fail.

func GetExecutableName

func GetExecutableName(tool string) string

GetExecutableName returns the executable name of a given tool based on the operating system. It returns the tool name with a .exe extension if the operating system is Windows, otherwise it returns the tool name as is.

func GetLocalFilepath

func GetLocalFilepath(overrideEnvVarName string, binaryName string) (string, error)

GetLocalFilepath checks for an override path in an environment variable, and if it exists, returns it. If not, it returns the path to the binary in the user's home directory. It returns an error if it cannot find the user's home directory or if the filename is invalid.

func GetValidPlatform

func GetValidPlatform(currentOS, currentArch string) (string, error)

GetValidPlatform checks if the given OS and architecture combination is supported and returns the corresponding platform string if it is, or an error if it is not.

Types

type ErrToolNotFound

type ErrToolNotFound struct {
	Tool    string
	Message string
}

func (ErrToolNotFound) Error

func (e ErrToolNotFound) Error() string

Error() returns a string containing the error message for the ErrToolNotFound struct.

Jump to

Keyboard shortcuts

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