feat: huge overhaul of messaging into FAIL, WARN, hint, ok, prompt, and progress types

This commit is contained in:
Lewis Wynne 2026-02-11 02:11:58 +00:00
parent 6ccd801c89
commit b52a5bfdb7
30 changed files with 192 additions and 96 deletions

View file

@ -5,4 +5,4 @@ $ pda dump --glob a*
{"key":"a1","value":"1","encoding":"text"}
{"key":"a2","value":"2","encoding":"text"}
$ pda dump --glob c* --> FAIL
Error: cannot ls '@default': No matches for pattern 'c*'
FAIL cannot ls '@default': no matches for pattern 'c*'

View file

@ -1,2 +1,2 @@
$ pda get key@foo/bar --> FAIL
Error: cannot get 'key@foo/bar': bad store format, use STORE or @STORE
FAIL cannot get 'key@foo/bar': bad store format, use STORE or @STORE

View file

@ -1,2 +1,2 @@
$ pda get foobar --> FAIL
Error: cannot get 'foobar': No such key
FAIL cannot get 'foobar': no such key

View file

@ -5,10 +5,10 @@ $ pda get foobar --include-binary --run --secret --> FAIL
$ pda get foobar --run --> FAIL
$ pda get foobar --run --secret --> FAIL
$ pda get foobar --secret --> FAIL
Error: cannot get 'foobar': No such key
Error: cannot get 'foobar': No such key
Error: cannot get 'foobar': No such key
Error: unknown flag: --secret
Error: cannot get 'foobar': No such key
Error: unknown flag: --secret
Error: unknown flag: --secret
FAIL cannot get 'foobar': no such key
FAIL cannot get 'foobar': no such key
FAIL cannot get 'foobar': no such key
FAIL unknown flag: --secret
FAIL cannot get 'foobar': no such key
FAIL unknown flag: --secret
FAIL unknown flag: --secret

View file

@ -1,3 +1,2 @@
$ pda invalidcmd --> FAIL
Error: unknown command "invalidcmd" for "pda"
Run 'pda --help' for usage.
FAIL unknown command "invalidcmd" for "pda"

View file

@ -1,2 +1,2 @@
$ pda ls foo/bar --> FAIL
Error: cannot ls 'foo/bar': cannot parse store: bad store format, use STORE or @STORE
FAIL cannot ls 'foo/bar': cannot parse store: bad store format, use STORE or @STORE

View file

@ -7,4 +7,4 @@ 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 'c*'
FAIL cannot ls '@lg': no matches for pattern 'c*'

View file

@ -1,2 +1,2 @@
$ pda rms foo/bar --> FAIL
Error: cannot delete-store 'foo/bar': cannot parse store: bad store format, use STORE or @STORE
FAIL cannot delete store 'foo/bar': cannot parse store: bad store format, use STORE or @STORE

View file

@ -10,6 +10,6 @@ $ pda ls
foo 1
$ pda rm foo --glob "*"
$ pda get bar --> FAIL
Error: cannot get 'bar': No such key
FAIL cannot get 'bar': no such key
$ pda get foo --> FAIL
Error: cannot get 'foo': No such key
FAIL cannot get 'foo': no such key

View file

@ -3,8 +3,8 @@ $ pda set bar1 2
$ pda set bar2 3
$ pda rm foo --glob bar*
$ pda get foo --> FAIL
Error: cannot get 'foo': No such key
FAIL cannot get 'foo': no such key
$ pda get bar1 --> FAIL
Error: cannot get 'bar1': No such key
FAIL cannot get 'bar1': no such key
$ pda get bar2 --> FAIL
Error: cannot get 'bar2': No such key
FAIL cannot get 'bar2': no such key

View file

@ -3,8 +3,9 @@ $ pda set a2 2
$ pda set b1 3
$ pda rm --glob a*
$ pda get a1 --> FAIL
Error: cannot get 'a1': No such key. Did you mean 'b1'?
FAIL cannot get 'a1': no such key
hint did you mean 'b1'?
$ pda get a2 --> FAIL
Error: cannot get 'a2': No such key
FAIL cannot get 'a2': no such key
$ pda get b1
3

View file

@ -2,6 +2,7 @@ $ pda set a 1
$ pda set b 2
$ pda rm a b
$ pda get a --> FAIL
Error: cannot get 'a': No such key
FAIL cannot get 'a': no such key
$ pda get b --> FAIL
Error: cannot get 'b': No such key. Did you mean 'b1'?
FAIL cannot get 'b': no such key
hint did you mean 'b1'?

View file

@ -2,8 +2,8 @@ $ pda set existing keep-me
$ pda set other also-keep
$ fecho dumpfile {"key":"new","value":"hello","encoding":"text"}
$ pda restore --drop --file dumpfile
Restored 1 entries into @default
ok restored 1 entries into @default
$ pda get new
hello
$ pda get existing --> FAIL
Error: cannot get 'existing': No such key
FAIL cannot get 'existing': no such key

View file

@ -4,12 +4,13 @@ $ 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 rm a1 a2 b1
$ pda restore --glob a* --file dumpfile
Restored 2 entries into @default
ok restored 2 entries into @default
$ pda get a1
1
$ pda get a2
2
$ pda get b1 --> FAIL
Error: cannot get 'b1': No such key. Did you mean 'a1'?
FAIL cannot get 'b1': no such key
hint did you mean 'a1'?
$ pda restore --glob c* --file dumpfile --> FAIL
Error: cannot restore '@default': No matches for pattern 'c*'
FAIL cannot restore '@default': no matches for pattern 'c*'

View file

@ -1,2 +1,2 @@
$ pda set a b --ttl 3343r --> FAIL
Error: invalid argument "3343r" for "-t, --ttl" flag: time: unknown unit "r" in duration "3343r"
FAIL invalid argument "3343r" for "-t, --ttl" flag: time: unknown unit "r" in duration "3343r"