updates

package
v0.67.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 23 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
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

type Updater struct {
	*common.Common
	// contains filtered or unexported fields
}

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

func (u *Updater) CanInstallInPlace() bool

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

func (u *Updater) CheckCanInstall() error

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

func (u *Updater) CheckForUpdateIfDue() error

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

func (u *Updater) ChecksEnabled() bool

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 (u *Updater) IsInstalling() bool

func (*Updater) IsUpdateInstalled added in v0.67.0

func (u *Updater) IsUpdateInstalled() bool

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

func (u *Updater) RefreshStatus() Status

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) Status added in v0.66.4

func (u *Updater) Status() Status

Status returns the status as of the last refresh

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL