program

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClearCache bool

ClearCache variable for clear-cache flag

Functions

func IsLatestVersion

func IsLatestVersion(p IProgram) bool

IsLatestVersion returns true if installed program is latest version.

func NewGithubClient

func NewGithubClient() (*github.Client, context.Context)

NewGithubClient returns github.Client with auth if available otherwise unauthenticated

Types

type Command

type Command struct {
	Path          string
	Cmd           string
	VersionArg    string
	VersionRegexp string
}

Command defines command, version args and regexp to find version number.

func (*Command) GetCmd

func (p *Command) GetCmd() string

GetCmd returns the command name

func (*Command) GetFullPath

func (p *Command) GetFullPath() string

GetFullPath returns the full path to the command

func (*Command) GetLocalVersion

func (p *Command) GetLocalVersion() string

GetLocalVersion runs Cmd with versionArg and finds version using versionRegexp, which it returns.

func (*Command) IsInstalled

func (p *Command) IsInstalled() bool

IsInstalled checks if command is installed and returns boolean

type GithubDirectDownloadProgram

type GithubDirectDownloadProgram struct {
	GithubProgram
}

GithubDirectDownloadProgram downloads a file directly

func (*GithubDirectDownloadProgram) DownloadLatestVersion

func (p *GithubDirectDownloadProgram) DownloadLatestVersion() string

DownloadLatestVersion downloads the latest release and puts it into the bindir

type GithubDownloadUntarFileProgram

type GithubDownloadUntarFileProgram struct {
	GithubProgram
	Filename string
}

GithubDownloadUntarFileProgram downloads a tarball and extracts a single file from it

func (*GithubDownloadUntarFileProgram) DownloadLatestVersion

func (p *GithubDownloadUntarFileProgram) DownloadLatestVersion() string

DownloadLatestVersion downloads and untars a file to the bindir

type GithubDownloadUnzipFileProgram

type GithubDownloadUnzipFileProgram struct {
	GithubProgram
	Filename string
}

GithubDownloadUnzipFileProgram downloads a zip-file and extracts a single file from it

func (*GithubDownloadUnzipFileProgram) DownloadLatestVersion

func (p *GithubDownloadUnzipFileProgram) DownloadLatestVersion() string

DownloadLatestVersion downloads and unzips a file to the bindir

type GithubProgram

type GithubProgram struct {
	Command
	GithubOwner string
	GithubRepo  string
	ReleaseName string // Will be appended when generating Github download URL. Ex: kustomize_{VERSION}_linux_amd64
	DownloadURL string // Optional, will be used instead of generating URL.
	PreRelease  bool   // Accept prereleases. Defaults to false
	TagName     string // Optional, will be used to find release. Ex: kustomize will find kustomize/v3.3.0. Used when multiple programs are released from the same repo.
}

GithubProgram is a Program released via Github

func (*GithubProgram) GetLatestVersion

func (p *GithubProgram) GetLatestVersion() (string, string, error)

GetLatestVersion returns the latest version available

type HashicorpProgram

type HashicorpProgram struct {
	Command
}

HashicorpProgram is for Hashicorp programs

func (*HashicorpProgram) DownloadLatestVersion

func (p *HashicorpProgram) DownloadLatestVersion() string

DownloadLatestVersion downloads and extracts the latest version

func (*HashicorpProgram) GetLatestVersion

func (p *HashicorpProgram) GetLatestVersion() (string, string, error)

GetLatestVersion returns the latest version number available

type IProgram

type IProgram interface {
	GetCmd() string
	GetFullPath() string
	GetLocalVersion() string
	GetLatestVersion() (string, string, error)
	IsInstalled() bool
	DownloadLatestVersion() string
}

IProgram defines a program

Jump to

Keyboard shortcuts

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