feat: picking the key shares, with no second popup
CI / Checks (pull_request) Successful in 40s
PR title / Conventional title (pull_request) Successful in 2s

The picker already shows what's shared. The confirmation stays for a
key from share.key, which wasn't picked. The share format's version
is documented as kept readable.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kebandClaude Opus 5.5 committed 2026-10-13 12:36:06 +02:00
1 parent 8cd0003f8c
commit 5c97a8e249
3 files changed
+31 -7

No files matched your search

+23 -4
View File
@@ -79,10 +79,7 @@ func shareFrom(t *testing.T, root string, paste bool) string {
}
d.keys("enter")
}
if !strings.Contains(d.screen(), ".env") || !strings.Contains(d.screen(), "db-password") {
t.Errorf("the files and key aren't shown before sharing:\n%s", d.screen())
}
d.keys("c")
// Picking it shares: the picker said what.
if !strings.HasPrefix(clip.content, "lazysecrets://share/") {
t.Fatalf("copied %q (%s)", clip.content, d.m.flash.text)
}
@@ -129,6 +126,28 @@ func TestShareFilesRoundTrip(t *testing.T) {
}
}
func TestShareWithShareKeyConfirms(t *testing.T) {
if _, err := exec.LookPath("git"); err != nil {
t.Skip("no git")
}
root := cloneWith(t, map[string]string{
".env": "A=1\n",
".lazysecrets.yaml": "share:\n key: https://" + kv + "/secrets/db-password\n",
})
clip := &fakeClipboard{}
d := newDriverOpts(t, Options{Clipboard: clip, ShareRules: demoRules}, fake.Azure(0), repo.New(repo.Settings{Dir: root}))
d.wait = scryptWait
d.keys("S", "f")
// The key wasn't picked: it shows which, before sharing.
if d.m.search != nil || d.m.prompt == nil || d.m.prompt.title != "Share .env" || !strings.Contains(d.screen(), "db-password") {
t.Fatalf("no confirmation:\n%s", d.screen())
}
d.keys("c")
if !strings.HasPrefix(clip.content, "lazysecrets://share/") {
t.Errorf("copied %q (%s)", clip.content, d.m.flash.text)
}
}
func TestShareLinkElsewhereAsksWhere(t *testing.T) {
if _, err := exec.LookPath("git"); err != nil {
t.Skip("no git")