feat(stores): adds mvs, and flags to bring store commands on par with key commands

This commit is contained in:
Lewis Wynne 2026-02-11 18:53:55 +00:00
parent b89db8dc48
commit 4e5064d07a
25 changed files with 247 additions and 9 deletions

View file

@ -1,6 +1,7 @@
# Cross-store copy
$ pda set key@src value
$ pda cp key@src key@dst
ok copied key@src to key@dst
$ pda get key@src
value
$ pda get key@dst

View file

@ -1,6 +1,7 @@
# Copy an encrypted key; both keys should decrypt.
$ pda set --encrypt secret-key@cpe hidden-value
$ pda cp secret-key@cpe copied-key@cpe
ok copied secret-key@cpe to copied-key@cpe
$ pda get secret-key@cpe
hidden-value
$ pda get copied-key@cpe

6
testdata/cp-safe.ct vendored Normal file
View file

@ -0,0 +1,6 @@
$ pda set src@csf hello
$ pda set dst@csf existing
$ pda cp src@csf dst@csf --safe
info skipped 'dst@csf': already exists
$ pda get dst@csf
existing

1
testdata/cp.ct vendored
View file

@ -1,6 +1,7 @@
# Basic copy
$ pda set source@cpok value
$ pda cp source@cpok dest@cpok
ok copied source@cpok to dest@cpok
$ pda get source@cpok
value
$ pda get dest@cpok

View file

@ -11,6 +11,7 @@ Aliases:
Flags:
-h, --help help for remove-store
-i, --interactive Prompt yes/no for each deletion
-y, --yes Skip all confirmation prompts
Delete a store
Usage:
@ -22,3 +23,4 @@ Aliases:
Flags:
-h, --help help for remove-store
-i, --interactive Prompt yes/no for each deletion
-y, --yes Skip all confirmation prompts

2
testdata/help.ct vendored
View file

@ -26,6 +26,7 @@ Store commands:
export Export store as NDJSON (alias for list --format ndjson)
import Restore key/value pairs from an NDJSON dump
list-stores List all stores
move-store Rename a store
remove-store Delete a store
Git commands:
@ -68,6 +69,7 @@ Store commands:
export Export store as NDJSON (alias for list --format ndjson)
import Restore key/value pairs from an NDJSON dump
list-stores List all stores
move-store Rename a store
remove-store Delete a store
Git commands:

View file

@ -1,6 +1,7 @@
# Cross-store move
$ pda set key@src value
$ pda mv key@src key@dst
ok renamed key@src to key@dst
$ pda get key@dst
value
$ pda get key@src --> FAIL

View file

@ -1,6 +1,7 @@
# Move an encrypted key; the new key should still decrypt.
$ pda set --encrypt secret-key@mve hidden-value
$ pda mv secret-key@mve moved-key@mve
ok renamed secret-key@mve to moved-key@mve
$ pda get moved-key@mve
hidden-value
$ pda get secret-key@mve --> FAIL

8
testdata/mv-safe.ct vendored Normal file
View file

@ -0,0 +1,8 @@
$ pda set src@msf hello
$ pda set dst@msf existing
$ pda mv src@msf dst@msf --safe
info skipped 'dst@msf': already exists
$ pda get src@msf
hello
$ pda get dst@msf
existing

7
testdata/mv-store-copy.ct vendored Normal file
View file

@ -0,0 +1,7 @@
$ pda set key@msc1 value
$ pda move-store msc1 msc2 --copy
ok copied @msc1 to @msc2
$ pda get key@msc1
value
$ pda get key@msc2
value

2
testdata/mv-store-missing-err.ct vendored Normal file
View file

@ -0,0 +1,2 @@
$ pda move-store nonexistent dest --> FAIL
FAIL cannot rename store 'nonexistent': no such store

8
testdata/mv-store-safe.ct vendored Normal file
View file

@ -0,0 +1,8 @@
$ pda set a@mssf1 1
$ pda set b@mssf2 2
$ pda move-store mssf1 mssf2 --safe
info skipped '@mssf2': already exists
$ pda get a@mssf1
1
$ pda get b@mssf2
2

3
testdata/mv-store-same-err.ct vendored Normal file
View file

@ -0,0 +1,3 @@
$ pda set a@mss same
$ pda move-store mss mss --> FAIL
FAIL cannot rename store 'mss': source and destination are the same

5
testdata/mv-store.ct vendored Normal file
View file

@ -0,0 +1,5 @@
$ pda set key@mvs1 value
$ pda move-store mvs1 mvs2
ok renamed @mvs1 to @mvs2
$ pda get key@mvs2
value

1
testdata/mv.ct vendored
View file

@ -1,6 +1,7 @@
# Basic move
$ pda set source@mvok value
$ pda mv source@mvok dest@mvok
ok renamed source@mvok to dest@mvok
$ pda get dest@mvok
value
$ pda get source@mvok --> FAIL

1
testdata/root.ct vendored
View file

@ -25,6 +25,7 @@ Store commands:
export Export store as NDJSON (alias for list --format ndjson)
import Restore key/value pairs from an NDJSON dump
list-stores List all stores
move-store Rename a store
remove-store Delete a store
Git commands:

View file

@ -2,6 +2,7 @@ $ pda set key@ss "original" --safe
$ pda get key@ss
"original"
$ pda set key@ss "overwritten" --safe
info skipped 'key@ss': already exists
$ pda get key@ss
"original"
$ pda set newkey@ss "fresh" --safe