Documentation
¶
Index ¶
- Constants
- Variables
- func CheckForUpdates() (latestVersion, releaseURL, releaseNotes string, hasUpdate bool, err error)
- func CheckForUpdatesCommit() (string, string, bool, error)
- func FormatUpdateMessage(current, latest, releaseURL, releaseNotes string) string
- func HasUpdate(current, latest string) bool
- func PrintUpdateMessage()
- type Asset
- type BuildInfo
- type CommitInfo
- type GithubRelease
- type Release
Constants ¶
View Source
const (
// VersionCheckURL is the URL to check for latest commit
VersionCheckURL = "https://api.github.com/repos/base-go/cmd/commits/main"
)
Variables ¶
View Source
var ( // Version is the current version of Base CLI Version = "1.1.1" // CommitHash is the git commit hash at build time CommitHash = "unknown" // BuildDate is the date when the binary was built BuildDate = "unknown" // GoVersion is the version of Go used to build the binary GoVersion = "unknown" )
Version information
Functions ¶
func CheckForUpdates ¶
CheckForUpdates checks GitHub for newer releases
func CheckForUpdatesCommit ¶
CheckForUpdates checks if there's a newer version available
func FormatUpdateMessage ¶
FormatUpdateMessage returns a formatted update message
func PrintUpdateMessage ¶
func PrintUpdateMessage()
PrintUpdateMessage prints update message if a new version is available
Types ¶
type Asset ¶
type Asset struct { Name string `json:"name"` BrowserDownloadURL string `json:"browser_download_url"` }
Asset represents a release asset
type BuildInfo ¶
type BuildInfo struct { Version string `json:"version"` CommitHash string `json:"commit_hash"` BuildDate string `json:"build_date"` GoVersion string `json:"go_version"` }
BuildInfo contains all version information
type CommitInfo ¶
type CommitInfo struct { SHA string `json:"sha"` Commit struct { Message string `json:"message"` Author struct { Date string `json:"date"` } `json:"author"` } `json:"commit"` HTMLURL string `json:"html_url"` }
CommitInfo represents the GitHub commit response
type GithubRelease ¶
type GithubRelease struct { TagName string `json:"tag_name"` PublishedAt time.Time `json:"published_at"` Body string `json:"body"` HTMLURL string `json:"html_url"` }
GithubRelease represents a GitHub release
type Release ¶
type Release struct { TagName string `json:"tag_name"` PublishedAt time.Time `json:"published_at"` Body string `json:"body"` HTMLURL string `json:"html_url"` Assets []Asset `json:"assets"` }
Release represents a GitHub release
func CheckLatestVersion ¶
CheckLatestVersion checks GitHub for newer releases
Click to show internal directories.
Click to hide internal directories.