fix: unambiguous repo key names, clearer config and key names, and a newer lazysecrets's files no longer stop an older one
This commit is contained in:
16 files changed
+189
-58
No files matched your search
+14
-2
@@ -5,6 +5,7 @@ package main
|
||||
import (
|
||||
"cmp"
|
||||
"context"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -194,6 +195,11 @@ Flags:
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Warnings show when the window opens.
|
||||
var warnings []string
|
||||
if w := styles.Unknown(cfg.Theme); w != "" {
|
||||
warnings = append(warnings, w)
|
||||
}
|
||||
keymap := keys.Default()
|
||||
if err := keymap.Apply(cfg.Keybinding); err != nil {
|
||||
return err
|
||||
@@ -208,6 +214,9 @@ Flags:
|
||||
// Precedence: flag > environment > config file > default.
|
||||
set := map[string]bool{}
|
||||
flag.Visit(func(f *flag.Flag) { set[f.Name] = true })
|
||||
if *timeout <= 0 {
|
||||
return fmt.Errorf("--timeout: %s is not positive", *timeout)
|
||||
}
|
||||
// Each provider's own timeout, unless --timeout sets them all.
|
||||
timeouts := map[provider.Kind]time.Duration{}
|
||||
if !set["timeout"] {
|
||||
@@ -265,7 +274,9 @@ Flags:
|
||||
statePath = filepath.Join(stateDir, "state.json")
|
||||
}
|
||||
st, err := store.Load(statePath)
|
||||
if err != nil {
|
||||
if errors.Is(err, store.ErrNewer) {
|
||||
warnings = append(warnings, err.Error()+": stars, notes and the layout won't be saved; update lazysecrets")
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -406,13 +417,14 @@ Flags:
|
||||
ExpiryWarning: time.Duration(expiryDays) * 24 * time.Hour,
|
||||
HideOnBlur: config.On(cfg.Values.HideOnBlur),
|
||||
HandlerSetup: setup,
|
||||
Updater: updater(cfg.Updates.UpdateSources),
|
||||
Updater: updater(cfg.Updates.Sources),
|
||||
UpdateCheck: config.On(cfg.Updates.AutoCheck),
|
||||
UpdateEvery: updateEvery,
|
||||
Keys: &keymap,
|
||||
Commands: cfg.CustomCommands,
|
||||
Version: versionString(),
|
||||
Store: st,
|
||||
Warning: strings.Join(warnings, " · "),
|
||||
CacheFile: cacheFile,
|
||||
ConfigFiles: configFiles(*configPath),
|
||||
StatePath: statePath,
|
||||
|
||||
@@ -43,7 +43,7 @@ func updateCmd(configPath string, args []string) error {
|
||||
current := versionString()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
|
||||
defer cancel()
|
||||
c := &update.Client{Servers: cfg.Updates.UpdateSources}
|
||||
c := &update.Client{Servers: cfg.Updates.Sources}
|
||||
r, err := c.Latest(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("looking for a newer lazysecrets: %w", err)
|
||||
|
||||
Reference in new issue
Block a user