feat: ui.recentIcon marks items used lately with ◷, and lazysecrets list --recent

This commit is contained in:
keb committed 2026-10-14 21:24:01 +02:00
1 parent 33a9b0864d
commit 33fa064104
9 files changed
+87 -22

No files matched your search

+18 -6
View File
@@ -19,6 +19,22 @@ import (
const star = "★ "
// recentMark marks items used lately (Recent), with ui.recentIcon.
const recentMark = "◷ "
// marks is what goes before a list row's name: ★ when it's starred for
// account and, with recent, ◷ when it was used lately.
func marks(st styles.Styles, n store.Node, account string, recent bool) string {
var s string
if n.StarredFor(account) {
s = st.Favourite.Render(star)
}
if recent && !n.LastUsed.IsZero() {
s += st.Muted.Render(recentMark)
}
return s
}
func sourceKey(s provider.Source) string {
if r, err := ref.ForSource(s); err == nil {
return r.String()
@@ -94,9 +110,7 @@ func (m Model) containerRender(withSource bool) func(styles.Styles, provider.Con
}
line += sty.Muted.Render(" " + c.Detail)
}
if n.StarredFor(c.Source.Provider) {
line = sty.Favourite.Render(star) + line
}
line = marks(sty, n, c.Source.Provider, m.recentIcon) + line
if withSource {
src := c.Source.Name
if account, ok := strings.CutPrefix(c.Source.ProviderLabel, string(c.Source.Kind)+" · "); ok {
@@ -116,9 +130,7 @@ func (m Model) objectRender() func(styles.Styles, provider.Object, int) string {
if o.Enabled != nil && !*o.Enabled {
line = sty.Muted.Render(o.Name + " (disabled)")
}
if n.StarredFor(o.Container.Source.Provider) {
line = sty.Favourite.Render(star) + line
}
line = marks(sty, n, o.Container.Source.Provider, m.recentIcon) + line
switch state, left := m.expiry(o); state {
case expired:
line += " " + sty.Error.Render("✗ expired")