Documentation
¶
Index ¶
- Constants
- func IsNewer(a, b string) bool
- func NewCmdUpdate(version string) *cobra.Command
- func ParseVersion(v string) [3]int
- func PrintNotice(w io.Writer, currentVersion string, result *CheckResult)
- func ShouldCheck(version string, args []string) bool
- type CheckResult
- type GithubAsset
- type GithubRelease
Constants ¶
View Source
const ( RepoOwner = "aarondpn" RepoName = "redmine-cli" ReleaseURL = "https://api.github.com/repos/" + RepoOwner + "/" + RepoName + "/releases/latest" )
Variables ¶
This section is empty.
Functions ¶
func IsNewer ¶ added in v1.12.0
IsNewer returns true if version a is newer than version b. Versions are expected as "major.minor.patch" (no "v" prefix).
func NewCmdUpdate ¶
NewCmdUpdate creates the update command.
func ParseVersion ¶ added in v1.12.0
ParseVersion parses a semver string into [major, minor, patch].
func PrintNotice ¶ added in v1.12.0
func PrintNotice(w io.Writer, currentVersion string, result *CheckResult)
PrintNotice writes an update notice to w.
func ShouldCheck ¶ added in v1.12.0
ShouldCheck returns true if the background update check should run.
Types ¶
type CheckResult ¶ added in v1.12.0
type CheckResult struct {
NewVersion string // e.g. "1.3.0" (without "v" prefix)
ReleaseURL string // full GitHub release page URL
}
CheckResult holds the outcome of a background update check.
func CheckForUpdate ¶ added in v1.12.0
func CheckForUpdate(ctx context.Context, currentVersion string) *CheckResult
CheckForUpdate checks GitHub for a newer release. It returns nil on any error or if the current version is already up to date.
type GithubAsset ¶ added in v1.12.0
type GithubAsset struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
}
GithubAsset represents a release asset.
type GithubRelease ¶ added in v1.12.0
type GithubRelease struct {
TagName string `json:"tag_name"`
Assets []GithubAsset `json:"assets"`
}
GithubRelease represents a GitHub release.
func FetchLatestRelease ¶ added in v1.12.0
func FetchLatestRelease(ctx context.Context) (*GithubRelease, error)
FetchLatestRelease fetches the latest release from GitHub.
Click to show internal directories.
Click to hide internal directories.