Documentation
¶
Index ¶
- Constants
- func CheckUpdate(f cmdutils.Factory, silentSuccess bool) error
- func CheckUpdateExplicit(f cmdutils.Factory) error
- func CreateUnauthenticatedClient(userAgent string, options ...api.ClientOption) (*api.Client, error)
- func MaybeShowPostUpgradeBanner(io *iostreams.IOStreams, cfg config.Config, buildInfo api.BuildInfo)
- func NewCheckUpdateCmd(f cmdutils.Factory) *cobra.Command
- func PrintUpdateError(streams *iostreams.IOStreams, err error, cmd *cobra.Command, debug bool)
- func SetLastSeenVersion(cfg config.Config, v string) error
- func ShouldSkipUpdate(previousCommand string) bool
- type InstallMethod
Constants ¶
const LastSeenVersionKey = "last_seen_version"
Variables ¶
This section is empty.
Functions ¶
func CheckUpdateExplicit ¶ added in v1.78.0
CheckUpdateExplicit performs an update check when explicitly invoked by the user. Unlike automatic checks, this bypasses the 24-hour throttle.
func CreateUnauthenticatedClient ¶ added in v1.102.0
func CreateUnauthenticatedClient(userAgent string, options ...api.ClientOption) (*api.Client, error)
CreateUnauthenticatedClient creates an API client without authentication for accessing public endpoints on gitlab.com. This avoids issues where user credentials (especially from environment variables like GITLAB_TOKEN) might be for self-hosted instances and invalid for gitlab.com.
func MaybeShowPostUpgradeBanner ¶ added in v1.102.0
func MaybeShowPostUpgradeBanner(io *iostreams.IOStreams, cfg config.Config, buildInfo api.BuildInfo)
MaybeShowPostUpgradeBanner prints a one-time nudge pointing at `glab whatsnew` whenever buildInfo.Version is newer than the recorded LastSeenVersionKey marker. The default for LastSeenVersionKey is seeded in defaultFor() so existing users see the banner the first time they run the release that ships this feature.
func PrintUpdateError ¶ added in v1.73.0
PrintUpdateError prints update check errors with helpful formatting and context. This is specifically for errors that occur during background update checks, not main command execution errors.
func SetLastSeenVersion ¶ added in v1.102.0
func ShouldSkipUpdate ¶
Don't CheckUpdate if previous command is CheckUpdate or it's Completion, so it doesn't take a noticeably long time to start new shells and we don't encourage users setting `check_update` to false in the config. Also skip for git-credential to avoid interfering with Git operations.
Types ¶
type InstallMethod ¶ added in v1.100.0
InstallMethod identifies how the running glab binary was installed and the command we should suggest to upgrade it. UpgradeCommand is empty when we can't determine the install method; callers should fall back to pointing users at the release notes URL.
func DetectInstallMethod ¶ added in v1.100.0
func DetectInstallMethod() InstallMethod
DetectInstallMethod inspects the resolved path of the running executable and returns its install method. It never panics: any error walking the path resolves to installMethodUnknown.