Documentation ¶
Overview ¶
Description: Provides miscellaneous helpers for the updater
Package updater implements an updater for CLIs that support multiple channels and version checks
Index ¶
- Variables
- func UseUpdater(ctx context.Context, opts ...Option) (*updater, error)
- type Option
- func WithApp(app *cli.App) Option
- func WithChannel(channel string) Option
- func WithCheckInterval(interval time.Duration) Option
- func WithDisabled(disabled bool) Option
- func WithExecutableName(execName string) Option
- func WithExecutablePath(execPath string) Option
- func WithForceCheck(forceCheck bool) Option
- func WithLogger(logger logrus.FieldLogger) Option
- func WithNoProgressBar(noProgressBar bool) Option
- func WithPrereleases(_ bool) Optiondeprecated
- func WithRepoURL(repo string) Option
- func WithSkipInstall(skipInstall bool) Option
- func WithSkipMajorVersionPrompt(skip bool) Option
- func WithVersion(version string) Option
Constants ¶
This section is empty.
Variables ¶
var ( // ConfigVersion is the current version of the configuration schema. ConfigVersion = 1 // ConfigFile is the non-HOME containing path to the config file for the updater ConfigFile = filepath.Join(".outreach", ".config", "updater", "config.yaml") )
This block contains constants for the updater's configuration and cache files.
var Disabled = "false"
Disabled globally disables the automatic updater. This is helpful for when using an external package manager, such as brew. This should usually be done with an ldflag:
go run -ldflags "-X github.com/getoutreach/gobox/pkg/cli/updater.Disabled=true" ...
or you can do it in main() before UseUpdater is called:
updater.Disabled = "true"
Any value other than "true" is considered false. The type is string to allow for invoking via `go run -ldflags "-X ..."`.
var UpdaterFlags = []cli.Flag{
&cli.BoolFlag{
Name: "skip-update",
Usage: "skips the updater check",
},
&cli.BoolFlag{
Name: "force-update-check",
Usage: "Force checking for an update",
},
}
The urfave flags the updater will inject.
Functions ¶
Types ¶
type Option ¶
type Option func(*updater)
Options configures an updater
func WithChannel ¶
WithChannel sets the channel to use for checking for updates
func WithCheckInterval ¶
WithCheckInterval sets the interval to check for updates. Defaults to 30 minutes.
func WithDisabled ¶
WithDisabled sets if we should disable the updater or not
func WithExecutableName ¶
WithExecutableName overrides the name of the executable. See u.executablePath. Deprecated: Use WithExecutablePath
func WithExecutablePath ¶ added in v1.53.2
WithExecutablePath overrides the path of the executable. See u.executablePath.
func WithForceCheck ¶
WithForceCheck sets whether or not to force the updater to check for updates otherwise updates are checked for only if the last check was more than the update check interval.
func WithLogger ¶
func WithLogger(logger logrus.FieldLogger) Option
WithLogger sets the logger to use for logging. If not set a io.Discard logger is created.
func WithNoProgressBar ¶
WithNoProgressBar sets whether or not to show the progress bar.
func WithPrereleases
deprecated
func WithRepoURL ¶
WithRepoURL sets the repository to use for checking for updates. The expected format is: https://<host>/<repo> Note: It should not contain .git at the end
func WithSkipInstall ¶
WithSkipInstall sets whether or not to skip the installation of the update
func WithSkipMajorVersionPrompt ¶
WithSkipMajorVersionPrompt sets whether or not to skip the prompt for major version upgrades
func WithVersion ¶
WithVersion sets the version to use as the current version when checking for updates. Defaults to app.Info().Version.
Directories ¶
Path | Synopsis |
---|---|
Package archive contains methods for extracting file(s) from arbitrary archive types.
|
Package archive contains methods for extracting file(s) from arbitrary archive types. |
Package release contains methods that interact with releases from VCS providers that do not exist natively in git.
|
Package release contains methods that interact with releases from VCS providers that do not exist natively in git. |
Package resolver contains a git tag aware version resolver that supports channels to determine the latest version.
|
Package resolver contains a git tag aware version resolver that supports channels to determine the latest version. |