Documentation
¶
Index ¶
- Constants
- type InstallKind
- type Installation
- type Reminder
- type Status
- type Updater
- func (u *Updater) CheckCanInstall() error
- func (u *Updater) CheckForUpdate() (*types.VersionNumber, error)
- func (u *Updater) CheckForUpdateIfDue() error
- func (u *Updater) ChecksEnabled() bool
- func (u *Updater) ClaimExitMessage() *types.VersionNumber
- func (u *Updater) CleanUpAfterUpdate()
- func (u *Updater) CurrentVersion() *types.VersionNumber
- func (u *Updater) DueReminder(reminder Reminder) *types.VersionNumber
- func (u *Updater) Install(version *types.VersionNumber) error
- func (u *Updater) Installation() Installation
- func (u *Updater) IsHandledAfter(t time.Time) bool
- func (u *Updater) IsInstalling() bool
- func (u *Updater) IsStartingUp() bool
- func (u *Updater) RecordResponse(version *types.VersionNumber)
- func (u *Updater) RefreshStatus() Status
- func (u *Updater) RemindersEnabled() bool
- func (u *Updater) SkipVersion(version *types.VersionNumber)
- func (u *Updater) Status() Status
- func (u *Updater) VersionToInstallInBackground() *types.VersionNumber
- func (u *Updater) WaitForInstallToFinish()
Constants ¶
const ( // Set by .goreleaser.yml for our release archives BuildSourceRelease = "binaryRelease" // Set by the Homebrew formula (to the name of the tap's owner) BuildSourceHomebrew = "Homebrew" // Set by mergeBuildInfo for builds made with // `go install github.com/jesseduffield/lazygit@<version>` BuildSourceGoInstall = "goInstall" )
The build sources that lazygit knows about. The build source is set with `-X main.buildSource=...` when building lazygit.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InstallKind ¶ added in v0.66.4
type InstallKind int
InstallKind says how lazygit was installed. This decides what we can offer the user when there's an update.
const ( // A build without a release version, e.g. one built from a git checkout. We // don't check for updates for these. InstallKindDevBuild InstallKind = iota // Installed from one of our release archives. We can update it in place. InstallKindRelease InstallKindHomebrew InstallKindGoInstall InstallKindScoop InstallKindWinget InstallKindChocolatey // Anything else with a release version, e.g. a package of a Linux // distribution. We can only tell the user that there's an update. InstallKindOther )
type Installation ¶ added in v0.66.4
type Installation struct {
Kind InstallKind
// The path of the lazygit executable, with symlinks resolved
ExecutablePath string
}
func DetectInstallation ¶ added in v0.66.4
func DetectInstallation(buildSource string, version string, executablePath string) Installation
func (Installation) PackageManagerName ¶ added in v0.66.4
func (self Installation) PackageManagerName() string
PackageManagerName returns the name of the package manager that lazygit was installed with, or "" if we don't know it.
func (Installation) UpdateCommand ¶ added in v0.66.4
func (self Installation) UpdateCommand() string
UpdateCommand returns the command that updates lazygit with the package manager that it was installed with, or "" if we don't know it.
type Reminder ¶ added in v0.66.4
type Reminder int
The ways in which lazygit reminds the user of an available update
const ( // Show the update menu after the user hasn't used lazygit for a while ReminderMenuWhenIdle Reminder = iota // Show the update menu at startup. We only do this if the user hasn't // responded to the menu for a long time, e.g. because they never leave // lazygit idle. ReminderMenuAtStartup // Print a message to the terminal after lazygit exits ReminderExitMessage )
type Status ¶ added in v0.66.4
type Status struct {
// The latest release that a check found, if it is newer than the running
// lazygit
AvailableVersion *types.VersionNumber
// The version that an update installed in place of the running lazygit.
// This lazygit, or another one running from the same executable, can have
// installed it. The new version takes effect when lazygit is restarted.
InstalledVersion *types.VersionNumber
}
Status is what lazygit knows about updates
type Updater ¶
Updater checks for new lazygit releases, and installs them if lazygit was installed from one of our release archives.
func NewUpdater ¶
func NewUpdater(cmn *common.Common, config config.AppConfigurer) *Updater
func (*Updater) CheckCanInstall ¶ added in v0.66.4
CheckCanInstall returns an error if we can't install an update in place because we don't have write access to the folder of the executable. Only call it for InstallKindRelease.
func (*Updater) CheckForUpdate ¶ added in v0.66.4
func (u *Updater) CheckForUpdate() (*types.VersionNumber, error)
CheckForUpdate returns the latest version if it is newer than the current one, or nil if it isn't. Don't call it for dev builds.
func (*Updater) CheckForUpdateIfDue ¶ added in v0.66.4
CheckForUpdateIfDue checks for an update if lazygit checks regularly, and the last successful check is long enough ago.
func (*Updater) ChecksEnabled ¶ added in v0.66.4
ChecksEnabled returns whether lazygit checks for updates regularly. It doesn't for dev builds.
func (*Updater) ClaimExitMessage ¶ added in v0.66.4
func (u *Updater) ClaimExitMessage() *types.VersionNumber
ClaimExitMessage returns the version to remind the user of in a message after lazygit exits, or nil if no reminder is due, and records that we print the message. We print it at most once a day.
func (*Updater) CleanUpAfterUpdate ¶ added in v0.66.4
func (u *Updater) CleanUpAfterUpdate()
CleanUpAfterUpdate removes files that an earlier update left behind
func (*Updater) CurrentVersion ¶ added in v0.66.4
func (u *Updater) CurrentVersion() *types.VersionNumber
CurrentVersion returns nil for dev builds
func (*Updater) DueReminder ¶ added in v0.66.4
func (u *Updater) DueReminder(reminder Reminder) *types.VersionNumber
DueReminder returns the version to remind the user of, or nil if no reminder is due
func (*Updater) Install ¶ added in v0.66.4
func (u *Updater) Install(version *types.VersionNumber) error
Install downloads the given release and installs it in place of the running lazygit. Only call it for InstallKindRelease.
func (*Updater) Installation ¶ added in v0.66.4
func (u *Updater) Installation() Installation
func (*Updater) IsHandledAfter ¶ added in v0.66.4
IsHandledAfter returns whether the user responded to the update menu in any lazygit instance after the given time, or the update got installed. A menu that was shown at that time is obsolete then.
func (*Updater) IsInstalling ¶ added in v0.66.4
func (*Updater) IsStartingUp ¶ added in v0.66.4
IsStartingUp returns whether lazygit started less than a minute ago
func (*Updater) RecordResponse ¶ added in v0.66.4
func (u *Updater) RecordResponse(version *types.VersionNumber)
RecordResponse records that the user responded to the update menu for the given version, in whatever way. lazygit doesn't show the menu again for a day, and the other lazygit instances close theirs.
func (*Updater) RefreshStatus ¶ added in v0.66.4
RefreshStatus reads the status from the app state, where other lazygit instances can have changed it, and returns it. Don't call it on the UI thread, because it accesses the file system.
func (*Updater) RemindersEnabled ¶ added in v0.66.4
RemindersEnabled returns whether lazygit reminds the user of available updates. With update.method set to never, it only shows the note in the bottom-right corner.
func (*Updater) SkipVersion ¶ added in v0.66.4
func (u *Updater) SkipVersion(version *types.VersionNumber)
SkipVersion keeps lazygit from reminding the user of the given version
func (*Updater) VersionToInstallInBackground ¶ added in v0.66.4
func (u *Updater) VersionToInstallInBackground() *types.VersionNumber
VersionToInstallInBackground returns the version that lazygit should install without asking the user, or nil if there's none. This is the case if the user config asks for it, and lazygit can update itself.
func (*Updater) WaitForInstallToFinish ¶ added in v0.66.4
func (u *Updater) WaitForInstallToFinish()
WaitForInstallToFinish waits until a running install is done replacing the executable, and keeps later installs from starting. Call it before exiting.