Documentation ¶
Index ¶
- Variables
- func CmdRan(err error) bool
- func GetExitStatus(err error) int
- func MustResolveTool(tool ToolInfo, version string, providers ...ToolProvider) string
- func ResolveTool(tool ToolInfo, version string, providers ...ToolProvider) (string, error)
- type ChainToolProvider
- type CommandContext
- func (c *CommandContext) Exec(stdout, stderr io.Writer, opts ...CommandOption) (ran bool, exitCode int, err error)
- func (c *CommandContext) ExecContext(ctx context.Context, stdout, stderr io.Writer, opts ...CommandOption) (ran bool, exitCode int, err error)
- func (c *CommandContext) Run(opts ...CommandOption) error
- func (c *CommandContext) RunContext(ctx context.Context, opts ...CommandOption) error
- func (c *CommandContext) RunOutput(opts ...CommandOption) (string, error)
- func (c *CommandContext) RunOutputContext(ctx context.Context, opts ...CommandOption) (string, error)
- func (c *CommandContext) RunV(opts ...CommandOption) error
- func (c *CommandContext) RunVContext(ctx context.Context, opts ...CommandOption) error
- type CommandOption
- type DefinedPathToolProvider
- func (p DefinedPathToolProvider) GetPath(tool ToolInfo, version string) (string, error)
- func (p DefinedPathToolProvider) GetPathWithConstraint(tool ToolInfo, constraints *semver.Constraints) (string, error)
- func (p DefinedPathToolProvider) GetPathWithVersion(tool ToolInfo, version *semver.Version) (string, error)
- type Downloader
- type DownloaderToolProvider
- func (p *DownloaderToolProvider) GetPath(tool ToolInfo, version string) (string, error)
- func (p *DownloaderToolProvider) GetPathWithConstraint(tool ToolInfo, constraints *semver.Constraints) (string, error)
- func (p *DownloaderToolProvider) GetPathWithVersion(tool ToolInfo, version *semver.Version) (string, error)
- type ExitStatus
- type GithubReleaseDownloader
- type Logger
- type NOOPLogger
- type PathToolProvider
- type SimpleLogger
- type ToolInfo
- type ToolProvider
Constants ¶
This section is empty.
Variables ¶
var ( CacheDirectory = filepath.Join(xdg.CacheHome(), "go-clitools", "cache") BinDirectory = filepath.Join(xdg.DataHome(), "go-clitools", "bin") CacheTimeout = time.Hour * 24 * 7 )
var (
ErrFailedToDetermineVersion = errors.New("failed to determine error version")
)
var (
ErrNoVersionConstraintSupport = errors.New("semver version constraints are not supported by this downloader")
)
Functions ¶
func CmdRan ¶
CmdRan examines the error to determine if it was generated as a result of a command running via os/exec.Command. If the error is nil, or the command ran (even if it exited with a non-zero exit code), CmdRan reports true. If the error is an unrecognized type, or it is an error from exec.Command that says the command failed to run (usually due to the command not existing or not being executable), it reports false.
func GetExitStatus ¶
GetExitStatus returns the exit status of the error if it is an exec.ExitErr or if it implements ExitStatus. It returns 0 if err is nil or 1 if it is an unrecognized error type
func MustResolveTool ¶
func MustResolveTool(tool ToolInfo, version string, providers ...ToolProvider) string
func ResolveTool ¶
func ResolveTool(tool ToolInfo, version string, providers ...ToolProvider) (string, error)
Types ¶
type ChainToolProvider ¶
type ChainToolProvider struct {
Providers []ToolProvider
}
func (*ChainToolProvider) GetPath ¶
func (p *ChainToolProvider) GetPath(tool ToolInfo, version string) (string, error)
func (*ChainToolProvider) GetPathWithConstraint ¶
func (p *ChainToolProvider) GetPathWithConstraint(tool ToolInfo, constraints *semver.Constraints) (string, error)
func (*ChainToolProvider) GetPathWithVersion ¶
func (p *ChainToolProvider) GetPathWithVersion(tool ToolInfo, version *semver.Version) (string, error)
type CommandContext ¶
func (*CommandContext) Exec ¶
func (c *CommandContext) Exec(stdout, stderr io.Writer, opts ...CommandOption) (ran bool, exitCode int, err error)
func (*CommandContext) ExecContext ¶
func (c *CommandContext) ExecContext(ctx context.Context, stdout, stderr io.Writer, opts ...CommandOption) (ran bool, exitCode int, err error)
func (*CommandContext) Run ¶
func (c *CommandContext) Run(opts ...CommandOption) error
func (*CommandContext) RunContext ¶
func (c *CommandContext) RunContext(ctx context.Context, opts ...CommandOption) error
func (*CommandContext) RunOutput ¶
func (c *CommandContext) RunOutput(opts ...CommandOption) (string, error)
func (*CommandContext) RunOutputContext ¶
func (c *CommandContext) RunOutputContext(ctx context.Context, opts ...CommandOption) (string, error)
func (*CommandContext) RunV ¶
func (c *CommandContext) RunV(opts ...CommandOption) error
RunV always outputs to Stdout and Stderr
func (*CommandContext) RunVContext ¶
func (c *CommandContext) RunVContext(ctx context.Context, opts ...CommandOption) error
RunVContext always outputs to Stdout and Stderr
type CommandOption ¶
type CommandOption = func(c *command)
func IgnoreOSEnvironment ¶
func IgnoreOSEnvironment() CommandOption
func SetEnvironmentVariables ¶
func SetEnvironmentVariables(env map[string]string) CommandOption
func SetLogger ¶
func SetLogger(logger Logger) CommandOption
func SetNOOPLogger ¶
func SetNOOPLogger() CommandOption
func SetStdin ¶ added in v0.0.6
func SetStdin(stdin io.Reader) CommandOption
func SetWorkingDirectory ¶
func SetWorkingDirectory(wd string) CommandOption
type DefinedPathToolProvider ¶
type DefinedPathToolProvider string
func (DefinedPathToolProvider) GetPath ¶
func (p DefinedPathToolProvider) GetPath(tool ToolInfo, version string) (string, error)
func (DefinedPathToolProvider) GetPathWithConstraint ¶
func (p DefinedPathToolProvider) GetPathWithConstraint(tool ToolInfo, constraints *semver.Constraints) (string, error)
func (DefinedPathToolProvider) GetPathWithVersion ¶
func (p DefinedPathToolProvider) GetPathWithVersion(tool ToolInfo, version *semver.Version) (string, error)
type Downloader ¶
type DownloaderToolProvider ¶
type DownloaderToolProvider struct {
Downloader Downloader
}
func (*DownloaderToolProvider) GetPath ¶
func (p *DownloaderToolProvider) GetPath(tool ToolInfo, version string) (string, error)
func (*DownloaderToolProvider) GetPathWithConstraint ¶
func (p *DownloaderToolProvider) GetPathWithConstraint(tool ToolInfo, constraints *semver.Constraints) (string, error)
func (*DownloaderToolProvider) GetPathWithVersion ¶
func (p *DownloaderToolProvider) GetPathWithVersion(tool ToolInfo, version *semver.Version) (string, error)
type ExitStatus ¶
type ExitStatus interface {
ExitStatus() int
}
type GithubReleaseDownloader ¶
type GithubReleaseDownloader struct { Tool string ToolExecutable string Owner string Repository string TagPrefix string AssetSelector string AssetSelectorRegexp bool Archived bool ArchivePath string MultipleReleases bool MultipleReleasesTagPrefix string }
func (*GithubReleaseDownloader) Download ¶
func (d *GithubReleaseDownloader) Download(version string) (string, error)
func (*GithubReleaseDownloader) DownloadWithConstraints ¶
func (d *GithubReleaseDownloader) DownloadWithConstraints(constraints *semver.Constraints) (string, error)
func (*GithubReleaseDownloader) DownloadWithVersion ¶
func (d *GithubReleaseDownloader) DownloadWithVersion(version *semver.Version) (string, error)
type Logger ¶
var DefaultLogger Logger = SimpleLogger{}
type NOOPLogger ¶
type NOOPLogger struct{}
type PathToolProvider ¶
type PathToolProvider struct { }
func (PathToolProvider) GetPath ¶
func (p PathToolProvider) GetPath(tool ToolInfo, version string) (string, error)
func (PathToolProvider) GetPathWithConstraint ¶
func (p PathToolProvider) GetPathWithConstraint(tool ToolInfo, constraints *semver.Constraints) (string, error)
func (PathToolProvider) GetPathWithVersion ¶
func (p PathToolProvider) GetPathWithVersion(tool ToolInfo, version *semver.Version) (string, error)
type SimpleLogger ¶
type SimpleLogger struct{}
type ToolProvider ¶
type ToolProvider interface { GetPath(tool ToolInfo, version string) (string, error) GetPathWithVersion(tool ToolInfo, version *semver.Version) (string, error) GetPathWithConstraint(tool ToolInfo, constraints *semver.Constraints) (string, error) }
var DefaultToolProvider ToolProvider = PathToolProvider{}
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Go is a tool for managing go source code.
|
Go is a tool for managing go source code. |
mod
Go mod provides access to operations on modules.
|
Go mod provides access to operations on modules. |
Deliver Go binaries as fast and easily as possible
|
Deliver Go binaries as fast and easily as possible |
cluster
Manage cluster(s)
|
Manage cluster(s) |
config
Work with config file(s)
|
Work with config file(s) |
image
Handle container images.
|
Handle container images. |
kubeconfig
Manage kubeconfig(s)
|
Manage kubeconfig(s) |
node
Manage node(s)
|
Manage node(s) |
A FAST Kubernetes manifests validator, with support for Custom Resources!
|
A FAST Kubernetes manifests validator, with support for Custom Resources! |
Manages declarative configuration of Kubernetes.
|
Manages declarative configuration of Kubernetes. |
cfg
Commands for reading and writing configuration
|
Commands for reading and writing configuration |
edit
Edits a kustomization file
|
Edits a kustomization file |
edit/add
Adds an item to the kustomization file.
|
Adds an item to the kustomization file. |
edit/remove
Removes items from the kustomization file.
|
Removes items from the kustomization file. |
edit/set
Sets the value of different fields in kustomization file.
|
Sets the value of different fields in kustomization file. |
Fast and powerful Git hooks manager for Node.js, Ruby or any other type of projects.
|
Fast and powerful Git hooks manager for Node.js, Ruby or any other type of projects. |
Correct commonly misspelled English words...
|
Correct commonly misspelled English words... |
Semantic Version Util is a tool to manage semantic versions at ease!
|
Semantic Version Util is a tool to manage semantic versions at ease! |