fix: unambiguous repo key names, clearer config and key names, and a newer lazysecrets's files no longer stop an older one (#66)
Changes that would break configs or links once people use lazysecrets, made while nobody does yet. - **Repo key names**: a dot or bracket inside a key is escaped (`app\.name`), so links to it resolve to that key and not to `app` → `name`. Dotenv files are flat, so their names stay as they are. - **Config**: `updates.updateSources` is now `updates.sources`. A negative provider timeout, or `--timeout` of 0 or less, is an error instead of making every request fail. - **Keybindings**: `lists.share` is now `lists.copyLink`, `lists.search` is `lists.goTo` and `lists.enter` is `lists.open`, matching what they do. - **Version skew**, e.g. a lazysecrets.nvim theme file made for a newer lazysecrets: - an unknown theme role is skipped with a warning instead of stopping startup; - a state file from a newer version is read but not saved to, with a warning; - a link with an unknown provider suggests `lazysecrets update`. Reviewed-on: #66 Co-authored-by: Karl-Einar Bergstrøm <karl-einarb@outlook.com>
This commit was merged in pull request #66.
This commit is contained in:
1 parent
e28328ef82
commit
a81fcaa5a6
16 files changed
+189
-58
No files matched your search
@@ -79,6 +79,9 @@ type Options struct {
|
||||
// and keeps its state, for the status pane.
|
||||
ConfigFiles []string
|
||||
StatePath string
|
||||
// Warning shows when the window opens: what lazysecrets skipped
|
||||
// instead of failing to start.
|
||||
Warning string
|
||||
// Changelog is CHANGELOG.md, for the status pane.
|
||||
Changelog string
|
||||
// CacheFile keeps what was loaded between runs; "" keeps it for this
|
||||
@@ -474,6 +477,9 @@ func New(providers []provider.Provider, opts Options) Model {
|
||||
m.cachePath, m.placeDir, m.sourcesAt = opts.CacheFile, opts.Dir, map[string]time.Time{}
|
||||
m.shareKey, m.shareRules = opts.ShareKey, opts.ShareRules
|
||||
m.configFiles, m.statePath, m.changelog = opts.ConfigFiles, opts.StatePath, changelogFields(opts.Changelog)
|
||||
if opts.Warning != "" {
|
||||
m.flash = warning(opts.Warning)
|
||||
}
|
||||
if m.cachePath != "" {
|
||||
m.loadCacheFile()
|
||||
if len(m.sourceResults) > 0 {
|
||||
|
||||
@@ -122,3 +122,11 @@ func TestUpdateAsked(t *testing.T) {
|
||||
t.Errorf("U on a dev build:\n%s", dev.screen())
|
||||
}
|
||||
}
|
||||
|
||||
func TestStartupWarning(t *testing.T) {
|
||||
t.Parallel()
|
||||
d := newDriverOpts(t, Options{Warning: "theme: skipped unknown activeBorder"})
|
||||
if !strings.Contains(d.screen(), "theme: skipped unknown activeBorder") {
|
||||
t.Errorf("no warning:\n%s", d.screen())
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user