feat: update settings move under updates, with an interval
updates.autoCheck (was updateCheck) and updates.updateSources (was releases) sit together with updates.autoCheckInterval, a duration (24h by default) for how often lazysecrets looks for a newer release on its own.
This commit is contained in:
9 files changed
+66
-34
No files matched your search
@@ -117,9 +117,11 @@ type Options struct {
|
||||
// Keys, if set, replaces the default keymap (keys.Map.Apply).
|
||||
Keys *keys.Map
|
||||
// Updater, if set, finds and installs newer releases (U); with
|
||||
// UpdateCheck, lazysecrets also looks once a day on its own.
|
||||
// UpdateCheck, lazysecrets also looks on its own at startup, at most
|
||||
// once per UpdateEvery (0 for a day).
|
||||
Updater *Updater
|
||||
UpdateCheck bool
|
||||
UpdateEvery time.Duration
|
||||
// HandlerSetup, if set, offers to set up the link handler at startup.
|
||||
HandlerSetup *HandlerSetup
|
||||
// NoHistory stops counting uses of items for the Recent list.
|
||||
@@ -236,6 +238,7 @@ type Model struct {
|
||||
|
||||
updater *Updater
|
||||
updateCheck bool
|
||||
updateEvery time.Duration
|
||||
fetchOnStart bool // look for a newer release in Init
|
||||
newer *update.Release // a newer release to offer
|
||||
updated string // the release installed, waiting for a restart
|
||||
@@ -427,7 +430,10 @@ func New(providers []provider.Provider, opts Options) Model {
|
||||
m.revealTimeout, m.hideOnBlur = opts.RevealTimeout, opts.HideOnBlur
|
||||
m.expiryWarning = opts.ExpiryWarning
|
||||
m.handlerSetup = opts.HandlerSetup
|
||||
m.updater, m.updateCheck = opts.Updater, opts.UpdateCheck
|
||||
m.updater, m.updateCheck, m.updateEvery = opts.Updater, opts.UpdateCheck, opts.UpdateEvery
|
||||
if m.updateEvery == 0 {
|
||||
m.updateEvery = updateEvery
|
||||
}
|
||||
m.startUpdateCheck()
|
||||
m.askHandler = opts.HandlerSetup != nil && !m.store.Flag(flagNoHandlerPrompt)
|
||||
m.settle = opts.LoadDelay
|
||||
|
||||
Reference in new issue
Block a user