Documentation
¶
Index ¶
- Constants
- type InstallKind
- type Installation
- type PackageManager
- type Status
- type Updater
- func (u *Updater) CanInstallInPlace() bool
- 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) CleanUpAfterUpdate()
- func (u *Updater) CurrentVersion() *types.VersionNumber
- func (u *Updater) DueReminder() *types.VersionNumber
- func (u *Updater) Install(version *types.VersionNumber) error
- func (u *Updater) Installation() Installation
- func (u *Updater) IsInstalling() bool
- func (u *Updater) IsUpdateInstalled() bool
- func (u *Updater) RefreshStatus() Status
- func (u *Updater) RemindTomorrow()
- 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" // Set by the program that runs integration tests BuildSourceIntegrationTest = "integration test" )
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 // check for updates for these only if we know which release they are based // on. 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, or "" if we
// don't know it
ExecutablePath string
}
func DetectInstallation ¶ added in v0.66.4
func DetectInstallation(buildSource string, version string, executablePath string) Installation
func (Installation) PackageManager ¶ added in v0.67.0
func (self Installation) PackageManager() *PackageManager
PackageManager returns the package manager that lazygit was installed with, or nil if we don't know how to update lazygit with it
type PackageManager ¶ added in v0.67.0
type PackageManager struct {
Name string
// The command that updates lazygit
UpdateCommand string
// Whether it can take a few days to get a new version of lazygit after we
// release it
CanBeSlow bool
}
PackageManager is a package manager that we know how to update lazygit with
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
// Whether an update was installed in place of the running lazygit since it
// started; see IsUpdateInstalled
UpdateInstalled bool
}
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) CanInstallInPlace ¶ added in v0.67.0
CanInstallInPlace returns whether lazygit can install updates in place of its executable, as opposed to telling the user how to update it. This depends on how lazygit was installed, and on whether we publish release archives for this platform. Whether we have write access to the folder of the executable is a separate question; see CheckCanInstall.
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 if CanInstallInPlace returns true.
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. update.days counts calendar days, so that with update.days set to 1, the check happens at the first start of each day, even if that is a bit earlier than on the day before.
func (*Updater) ChecksEnabled ¶ added in v0.66.4
ChecksEnabled returns whether lazygit checks for updates regularly. It doesn't if it has no version to compare with our releases, e.g. for a dev build that isn't based on a release.
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 the version that we compare with our releases; see comparableVersion. For a dev build, this is the release that it is based on.
func (*Updater) DueReminder ¶ added in v0.66.4
func (u *Updater) DueReminder() *types.VersionNumber
DueReminder returns the version to remind the user of with the update menu, or nil if no reminder is due. Don't call it on the UI thread, because it accesses the file system.
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. If an update is installed already, it does nothing. Only call it if CanInstallInPlace returns true.
func (*Updater) Installation ¶ added in v0.66.4
func (u *Updater) Installation() Installation
func (*Updater) IsInstalling ¶ added in v0.66.4
func (*Updater) IsUpdateInstalled ¶ added in v0.67.0
IsUpdateInstalled returns whether an update was installed in place of the running lazygit since it started. This lazygit, or another one running from the same executable, can have installed it. The new version takes effect when lazygit is restarted. Don't call it on the UI thread, because it accesses the file system.
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) RemindTomorrow ¶ added in v0.67.0
func (u *Updater) RemindTomorrow()
RemindTomorrow keeps lazygit from showing the update menu at startup until the next day. It also undoes skipping a version; if the user responded to the menu in several lazygit instances, the last response counts.
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. Don't call it on the UI thread, because it accesses the file system.
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.