Documentation
¶
Overview ¶
Copyright © 2022 Diego Morales <dgmorales@gmail.com>
Copyright © 2022 Diego Morales <dgmorales@gmail.com>
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Current string
Functions ¶
This section is empty.
Types ¶
type Assertion ¶ added in v0.3.0
type Assertion int
Assertion informs if our version is latest, can or must update.
Its values may be used as shell exit status codes for a version check command.
won't use iota bellow because values matter for use as exit codes Avoid using 1 and 2 that are frequently used as more general error exit codes for commands: https://tldp.org/LDP/abs/html/exitcodes.html
type GitHubChecker ¶ added in v0.3.0
type GitHubChecker struct {
// contains filtered or unexported fields
}
func NewGithubChecker ¶ added in v0.3.0
func NewGithubChecker(client *github.Client, owner string, repo string, minimalReq string, current string) (*GitHubChecker, error)
DiscoverLatest discovers what is the latest version from GitHub Releases
It already saves asset information, leaving everything ready for calling Download()
func (*GitHubChecker) Check ¶ added in v0.3.0
func (c *GitHubChecker) Check() (Assertion, error)
Check checks if current version can or must be updated
It is OK for the version information on cliInfo to be unset (nil), maybe because of previous errors parsing it. That is a noop and will return IsLatest and nil error on that case.
It does return error on some very abnormal cases (gross programming errors)
func (*GitHubChecker) Current ¶ added in v0.3.0
func (c *GitHubChecker) Current() string
Current returns current version as string
func (*GitHubChecker) DownloadLatest ¶ added in v0.3.0
func (c *GitHubChecker) DownloadLatest() (filename string, err error)
Download downloads the saved GitHub Release Asset to a temporary file
func (*GitHubChecker) Latest ¶ added in v0.3.0
func (c *GitHubChecker) Latest() string
Latest returns latest version as string
func (*GitHubChecker) Minimal ¶ added in v0.3.0
func (c *GitHubChecker) Minimal() string
Minimal returns minimal required version as string