feat: lazysecrets list prints every source, vault and secret, for fzf and editor pickers

This commit is contained in:
keb committed 2026-10-14 21:24:01 +02:00
1 parent dbb0eb2bbd
commit b1455451e6
13 files changed
+886 -91

No files matched your search

+14 -1
View File
@@ -121,6 +121,10 @@ func run() error {
{{secrets/scope/key}}
lazysecrets [flags] get <ref> print the value a lazysecrets:// link points at,
for scripts: VAR=$(lazysecrets get <ref>)
lazysecrets [flags] list [--cached] [--max-age 2m] [--format text|json]
print every source, vault and secret it can
find, one per line, for fzf and pickers:
what's cached at once, then what loads
lazysecrets [flags] share [--key <secret>] <env file>...
print a link to env files of a repo, encrypted
with a secret's value (default: sharing.key)
@@ -146,7 +150,7 @@ Flags:
}
var open, getRef *ref.Ref
var shareArgs []string
var shareArgs, listArgs []string
printKeys := false
switch args := flag.Args(); {
case len(args) > 0 && args[0] == "share":
@@ -154,6 +158,8 @@ Flags:
if len(shareArgs) == 0 {
shareArgs = []string{} // still sharing: says how
}
case len(args) > 0 && args[0] == "list":
listArgs = append([]string{}, args[1:]...) // not nil: listing
case len(args) == 1 && args[0] == "keybindings":
printKeys = true
case len(args) == 2 && args[0] == "get":
@@ -345,6 +351,13 @@ Flags:
defer cancel()
return get(ctx, providers, st, *getRef)
}
if listArgs != nil {
cachePath := ""
if d, err := config.CacheDir(); err == nil && !*demo && config.On(cfg.Storage.Cache) {
cachePath = filepath.Join(d, "cache.json")
}
return listCmd(providers, cachePath, timeoutFor, listArgs, os.Stdout, os.Stderr)
}
if shareArgs != nil {
// The files from a repo, the key from whichever provider it's
// in: the longest timeout.