feat(globs): glob support extended to ls and documented in README

This commit is contained in:
Lewis Wynne 2025-12-17 19:40:05 +00:00
parent badbf3b6bb
commit 95c9ac8fca
8 changed files with 316 additions and 74 deletions

10
testdata/del__glob__mixed__ok.ct vendored Normal file
View file

@ -0,0 +1,10 @@
$ pda set foo 1
$ pda set bar1 2
$ pda set bar2 3
$ pda del foo --glob bar* --force
$ pda get foo --> FAIL
Error: cannot get 'foo': Key not found
$ pda get bar1 --> FAIL
Error: cannot get 'bar1': Key not found
$ pda get bar2 --> FAIL
Error: cannot get 'bar2': Key not found

View file

@ -9,9 +9,10 @@ Aliases:
del, delete, rm, remove
Flags:
-f, --force Force delete without confirmation
-g, --glob Treat KEY arguments as glob patterns
-h, --help help for del
-f, --force Force delete without confirmation
-g, --glob strings Delete keys matching glob pattern (repeatable)
--glob-sep string Characters treated as separators for globbing (default "/-_.@: ")
-h, --help help for del
Delete one or more keys. Optionally specify a db.
Usage:
@ -21,6 +22,7 @@ Aliases:
del, delete, rm, remove
Flags:
-f, --force Force delete without confirmation
-g, --glob Treat KEY arguments as glob patterns
-h, --help help for del
-f, --force Force delete without confirmation
-g, --glob strings Delete keys matching glob pattern (repeatable)
--glob-sep string Characters treated as separators for globbing (default "/-_.@: ")
-h, --help help for del

View file

@ -9,14 +9,16 @@ Aliases:
list, ls
Flags:
-b, --binary include binary data in text output
-o, --format format output format (table|tsv|csv|markdown|html) (default table)
--header include header row
-h, --help help for list
--no-keys suppress the key column
--no-values suppress the value column
-S, --secret display values marked as secret
-t, --ttl append a TTL column when entries expire
-b, --binary include binary data in text output
-o, --format format output format (table|tsv|csv|markdown|html) (default table)
-g, --glob strings Filter keys with glob pattern (repeatable)
--glob-sep string Characters treated as separators for globbing (default "/-_.@: ")
--header include header row
-h, --help help for list
--no-keys suppress the key column
--no-values suppress the value column
-S, --secret display values marked as secret
-t, --ttl append a TTL column when entries expire
List the contents of a db.
Usage:
@ -26,11 +28,13 @@ Aliases:
list, ls
Flags:
-b, --binary include binary data in text output
-o, --format format output format (table|tsv|csv|markdown|html) (default table)
--header include header row
-h, --help help for list
--no-keys suppress the key column
--no-values suppress the value column
-S, --secret display values marked as secret
-t, --ttl append a TTL column when entries expire
-b, --binary include binary data in text output
-o, --format format output format (table|tsv|csv|markdown|html) (default table)
-g, --glob strings Filter keys with glob pattern (repeatable)
--glob-sep string Characters treated as separators for globbing (default "/-_.@: ")
--header include header row
-h, --help help for list
--no-keys suppress the key column
--no-values suppress the value column
-S, --secret display values marked as secret
-t, --ttl append a TTL column when entries expire

10
testdata/list__glob__ok.ct vendored Normal file
View file

@ -0,0 +1,10 @@
$ pda set a1@lg 1
$ pda set a2@lg 2
$ pda set b1@lg 3
$ pda ls lg --glob a* --format tsv
a1 1
a2 2
$ pda ls lg --glob b* --format tsv
b1 3
$ pda ls lg --glob c* --> FAIL
Error: cannot ls '@lg': No matches for pattern