feat: lazysecrets list marks starred and recent entries, and --starred-icon shows the stars
This commit is contained in:
5 files changed
+74
-3
No files matched your search
@@ -39,6 +39,10 @@ type Entry struct {
|
||||
Account string `json:"account"`
|
||||
// AccountLabel names the az account, when there are several.
|
||||
AccountLabel string `json:"accountLabel,omitempty"`
|
||||
// Starred is starred for this account; Recent is used lately (Recent,
|
||||
// R, in the TUI).
|
||||
Starred bool `json:"starred"`
|
||||
Recent bool `json:"recent"`
|
||||
// Error says why a source's vaults or a vault's secrets couldn't be
|
||||
// listed. The entry is then that source or vault, again, or with an
|
||||
// account's sources unreadable, the account without a link.
|
||||
@@ -56,7 +60,10 @@ type Options struct {
|
||||
// Kinds are the kinds of entry to list (Kinds' names); none is all.
|
||||
// Lists only needed for other kinds aren't loaded: sources and vaults
|
||||
// alone don't load any secrets. Lists that fail are always listed.
|
||||
Kinds []string
|
||||
Kinds []string
|
||||
// Mark tells whether the entry with link is starred for account, and
|
||||
// used lately; nil marks nothing.
|
||||
Mark func(link, account string) (starred, recent bool)
|
||||
Timeout func(provider.Kind) time.Duration
|
||||
Now func() time.Time
|
||||
}
|
||||
@@ -217,6 +224,9 @@ func (l *lister) put(p provider.Provider, e Entry) {
|
||||
return
|
||||
}
|
||||
e.Account = p.ID()
|
||||
if l.o.Mark != nil && e.Link != "" {
|
||||
e.Starred, e.Recent = l.o.Mark(e.Link, e.Account)
|
||||
}
|
||||
id := p.ID() + "\x00" + e.Link + "\x00" + e.Error
|
||||
if l.stopped != nil || l.seen[id] {
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user