Documentation
¶
Index ¶
Constants ¶
const ( // DefaultCheckInterval is the default time between update checks DefaultCheckInterval = 24 * time.Hour // GitHubRepo is the repository to check for updates GitHubRepo = "jfox85/devx" )
Variables ¶
This section is empty.
Functions ¶
func CanSelfUpdate ¶
func CanSelfUpdate() bool
CanSelfUpdate returns true if the installation method supports self-update
func GetUpdateInstructions ¶
func GetUpdateInstructions() string
GetUpdateInstructions returns platform-specific update instructions
func MarkUpdateNotified ¶
MarkUpdateNotified marks an update version as having been shown to the user This should be called after successfully displaying an update notification
func PerformUpdate ¶
PerformUpdate downloads and installs the latest version
func ShouldNotifyUser ¶
func ShouldNotifyUser(info *UpdateInfo) (bool, error)
ShouldNotifyUser determines if we should notify the user about an update Returns true if: - An update is available - We haven't already notified about this version
func UpdateAvailable ¶
UpdateAvailable checks if an update is available without downloading
Types ¶
type InstallMethod ¶
type InstallMethod string
InstallMethod represents how devx was installed
const ( InstallMethodHomebrew InstallMethod = "homebrew" InstallMethodGoInstall InstallMethod = "go-install" InstallMethodManual InstallMethod = "manual" InstallMethodUnknown InstallMethod = "unknown" )
func DetectInstallMethod ¶
func DetectInstallMethod() InstallMethod
DetectInstallMethod tries to determine how devx was installed
type UpdateInfo ¶
type UpdateInfo struct {
CurrentVersion string
LatestVersion string
ReleaseNotes string
ReleaseURL string
Available bool
}
UpdateInfo contains information about an available update
func CheckForUpdates ¶
func CheckForUpdates() (*UpdateInfo, error)
CheckForUpdates checks GitHub for a newer version
func CheckForUpdatesWithCache ¶
func CheckForUpdatesWithCache(interval time.Duration) (*UpdateInfo, bool, error)
CheckForUpdatesWithCache checks for updates if the check interval has passed