Documentation ¶
Index ¶
- Constants
- func CopyFile(src, dst string) (int64, error)
- func CopyFileP(src, dst string, permMode int) (int64, error)
- func CreateToolsTable(tools Tools, format TableFormat)
- func Download(tool *Tool, arch, operatingSystem, version string, movePath string, ...) (string, string, error)
- func DownloadFileP(downloadURL string, displayProgress bool) (string, error)
- func FindGitHubRelease(owner, repo string) (string, error)
- func FindRelease(location, owner, repo string) (string, error)
- func GetBinaryName(tool *Tool, os, arch, version string) (string, error)
- func GetDownloadURL(tool *Tool, os, arch, version string, quiet bool) (string, error)
- func GetToolVersion(tool *Tool, version string) string
- func PostInstallationMsg(movePath string, localToolsStore []ToolLocal) ([]byte, error)
- func PostToolNotFoundMsg(url string) string
- func ValidateArch(name string) error
- func ValidateOS(name string) error
- type ErrNotFound
- type ReleaseLocation
- type TableFormat
- type Tool
- type ToolLocal
- type Tools
Constants ¶
const ( DownloadTempDir = iota DownloadArkadeDir = iota )
const GitHubVersionStrategy = "github"
const GitLabVersionStrategy = "gitlab"
Variables ¶
This section is empty.
Functions ¶
func CreateToolsTable ¶
func CreateToolsTable(tools Tools, format TableFormat)
CreateToolTable creates table to show the avaiable CLI tools
func DownloadFileP ¶
DownloadFile downloads a file to a temporary directory and returns the path to the file and any error.
func FindGitHubRelease ¶
func FindRelease ¶
func GetBinaryName ¶
GetBinaryName returns the name of a binary for the given tool or an error if the tool's template cannot be parsed or executed.
func GetDownloadURL ¶
GetDownloadURL fetches the download URL for a release of a tool for a given os, architecture and version
func GetToolVersion ¶
func PostInstallationMsg ¶
PostInstallationMsg generates installation message after tool has been downloaded
func PostToolNotFoundMsg ¶
func ValidateArch ¶
ValidateArch returns whether a given cpu architecture is supported
func ValidateOS ¶
ValidateOS returns whether a given operating system is supported
Types ¶
type ErrNotFound ¶
type ErrNotFound struct { }
func (*ErrNotFound) Error ¶
func (e *ErrNotFound) Error() string
type ReleaseLocation ¶
type TableFormat ¶
type TableFormat string
const ( TableStyle TableFormat = "table" MarkdownStyle TableFormat = "markdown" ListStyle TableFormat = "list" )
type Tool ¶
type Tool struct { // The name of the tool for download Name string // Repo is a GitHub repo, when no repo exists, use the same // as the name. Repo string // Owner is the name of the GitHub account, when no account // exists, use the vendor name lowercase. Owner string // Version pinned or left empty to pull the latest release // if any only if only BinaryTemplate is specified. Version string // Bespoke approach for finding version when none is set. VersionStrategy string // Description of what the tool is used for. Description string // URLTemplate specifies a Go template for the download URL // override the OS, architecture and extension // All whitespace will be trimmed/ URLTemplate string // The binary template can be used when downloading GitHub // It assumes that the only part of the URL needing to be // templated is the binary name on a standard GitHub download // URL. BinaryTemplate string // NoExtension is required for tooling such as kubectx // which at time of writing is a bash script. NoExtension bool }
Tool describes how to download a CLI tool from a binary release - whether a single binary, or an archive.
type Tools ¶
type Tools []Tool
func GetDownloadURLs ¶
GetDownloadURLs generates a list of URL for each tool, for download