feat(globs): glob support for dump/restore, extracts some shared logic

This commit is contained in:
Lewis Wynne 2025-12-17 22:18:15 +00:00
parent 9869b663e2
commit 7890e9451d
9 changed files with 141 additions and 57 deletions

15
testdata/restore__glob__ok.ct vendored Normal file
View file

@ -0,0 +1,15 @@
$ pda set a1 1
$ pda set a2 2
$ pda set b1 3
$ fecho dumpfile {"key":"a1","value":"1","encoding":"text"} {"key":"a2","value":"2","encoding":"text"} {"key":"b1","value":"3","encoding":"text"}
$ pda del a1 a2 b1 --force
$ pda restore --glob a* --file dumpfile
Restored 2 entries into @default
$ pda get a1
1
$ pda get a2
2
$ pda get b1 --> FAIL
Error: cannot get 'b1': Key not found
$ pda restore --glob c* --file dumpfile --> FAIL
Error: cannot restore '@default': No matches for pattern