`lazysecrets list` prints every source, vault and secret lazysecrets can find, one per line, for fzf, editor pickers and scripts: what Go to searches, without the TUI. What's cached prints at once; what's missing or older than `--max-age` loads in the background and streams in. It stops when the reader goes (a pick in fzf), saving what it loaded. - Text: kind, mark (✗/⚠, ★, ◷ and the provider icon), name, status (why it couldn't be read, or expired / expires in 12d), note, account and link, tab-separated; kind first and account and link last, so new fields go between. Coloured from the theme; `--color never`, `--icons=false`, `--stars=false`, `--recent`, `--notes=false`, `--expiry=false`. - `--format json`: an object per line, with starred, recent, lastUsed and uses, expires, enabled, note, reference and url too. - `--kind` lists only some kinds, and doesn't load lists only other kinds need; `--cached` loads nothing. - `lazysecrets open --action go|copy|show` skips the "what to do" menu and ends in the list, like Go to; `open` and `get` take `--account`, the account list printed, rather than asking which. - The cache file moved to `internal/cachefile`: saves merge with the file under a lock, so list and the TUI don't undo each other. - `ui.recentIcon` marks items used lately with ◷ in the TUI's lists too; Recent now means the last 90 days. - --demo has stars, notes, recent use, and expired, expiring and disabled secrets. - docs/integration.md documents get, list and an fzf picker; docs/links.md is docs/sharing.md. Reviewed-on: #70 Co-authored-by: Karl-Einar Bergstrøm <karl-einarb@outlook.com>
48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
// Package icons maps backends to Nerd Font glyphs. They are on by default
|
|
// and can be turned off, since they render as boxes without a Nerd Font
|
|
// (v3+) installed.
|
|
package icons
|
|
|
|
import "git.kebcloud.no/keb/lazysecrets/internal/provider"
|
|
|
|
type Set struct {
|
|
Azure string
|
|
Databricks string
|
|
Repo string
|
|
Encrypted string // an encrypted file (SOPS)
|
|
PlainFile string // a plain text secrets file (.env)
|
|
Note string // has a note (lazysecrets list)
|
|
}
|
|
|
|
// None renders no icons.
|
|
var None = Set{}
|
|
|
|
// NerdFont uses Nerd Fonts v3 Material Design glyphs. There is no Databricks
|
|
// logo glyph, so it uses stacked layers, which resembles it.
|
|
var NerdFont = Set{
|
|
Azure: "\U000F0805", // md-microsoft_azure
|
|
Databricks: "\U000F0F58", // md-layers_triple
|
|
Repo: "\U000F02A2", // md-git
|
|
Encrypted: "\U000F033E", // md-lock
|
|
PlainFile: "\U000F0214", // md-file
|
|
Note: "\U000F09ED",
|
|
}
|
|
|
|
// Prefix returns the icon for kind followed by a space, or "" if the set has
|
|
// no icon for it.
|
|
func (s Set) Prefix(kind provider.Kind) string {
|
|
var icon string
|
|
switch kind {
|
|
case provider.KindAzure:
|
|
icon = s.Azure
|
|
case provider.KindDatabricks:
|
|
icon = s.Databricks
|
|
case provider.KindRepo:
|
|
icon = s.Repo
|
|
}
|
|
if icon == "" {
|
|
return ""
|
|
}
|
|
return icon + " "
|
|
}
|