refactor(del): made remove the default case
This commit is contained in:
parent
3d5a3f2aa1
commit
c2d1ec0842
21 changed files with 145 additions and 103 deletions
2
testdata/del-db__err__with__invalid_db.ct
vendored
2
testdata/del-db__err__with__invalid_db.ct
vendored
|
|
@ -1,2 +1,2 @@
|
|||
$ pda del-store foo/bar --> FAIL
|
||||
$ pda rms foo/bar --> FAIL
|
||||
Error: cannot delete-store 'foo/bar': cannot parse store: bad store format, use STORE or @STORE
|
||||
|
|
|
|||
2
testdata/del__dedupe__ok.ct
vendored
2
testdata/del__dedupe__ok.ct
vendored
|
|
@ -3,7 +3,7 @@ $ pda set bar 2
|
|||
$ pda ls
|
||||
bar 2
|
||||
foo 1
|
||||
$ pda del foo --glob "*"
|
||||
$ pda rm foo --glob "*"
|
||||
$ pda get bar --> FAIL
|
||||
Error: cannot get 'bar': Key not found
|
||||
$ pda get foo --> FAIL
|
||||
|
|
|
|||
2
testdata/del__glob__mixed__ok.ct
vendored
2
testdata/del__glob__mixed__ok.ct
vendored
|
|
@ -1,7 +1,7 @@
|
|||
$ pda set foo 1
|
||||
$ pda set bar1 2
|
||||
$ pda set bar2 3
|
||||
$ pda del foo --glob bar*
|
||||
$ pda rm foo --glob bar*
|
||||
$ pda get foo --> FAIL
|
||||
Error: cannot get 'foo': Key not found
|
||||
$ pda get bar1 --> FAIL
|
||||
|
|
|
|||
2
testdata/del__glob__ok.ct
vendored
2
testdata/del__glob__ok.ct
vendored
|
|
@ -1,7 +1,7 @@
|
|||
$ pda set a1 1
|
||||
$ pda set a2 2
|
||||
$ pda set b1 3
|
||||
$ pda del --glob a*
|
||||
$ pda rm --glob a*
|
||||
$ pda get a1 --> FAIL
|
||||
Error: cannot get 'a1': Key not found
|
||||
$ pda get a2 --> FAIL
|
||||
|
|
|
|||
2
testdata/del__multiple__ok.ct
vendored
2
testdata/del__multiple__ok.ct
vendored
|
|
@ -1,6 +1,6 @@
|
|||
$ pda set a 1
|
||||
$ pda set b 2
|
||||
$ pda del a b
|
||||
$ pda rm a b
|
||||
$ pda get a --> FAIL
|
||||
Error: cannot get 'a': Key not found
|
||||
$ pda get b --> FAIL
|
||||
|
|
|
|||
2
testdata/del__ok.ct
vendored
2
testdata/del__ok.ct
vendored
|
|
@ -1,2 +1,2 @@
|
|||
$ pda set a b
|
||||
$ pda del a
|
||||
$ pda rm a
|
||||
|
|
|
|||
16
testdata/help__del-db__ok.ct
vendored
16
testdata/help__del-db__ok.ct
vendored
|
|
@ -1,24 +1,24 @@
|
|||
$ pda help del-store
|
||||
$ pda del-store --help
|
||||
$ pda help rms
|
||||
$ pda rms --help
|
||||
Delete a store
|
||||
|
||||
Usage:
|
||||
pda del-store STORE [flags]
|
||||
pda remove-store STORE [flags]
|
||||
|
||||
Aliases:
|
||||
del-store, delete-store, rm-store, remove-store
|
||||
remove-store, rm-store, rms
|
||||
|
||||
Flags:
|
||||
-h, --help help for del-store
|
||||
-h, --help help for remove-store
|
||||
-i, --interactive Prompt yes/no for each deletion
|
||||
Delete a store
|
||||
|
||||
Usage:
|
||||
pda del-store STORE [flags]
|
||||
pda remove-store STORE [flags]
|
||||
|
||||
Aliases:
|
||||
del-store, delete-store, rm-store, remove-store
|
||||
remove-store, rm-store, rms
|
||||
|
||||
Flags:
|
||||
-h, --help help for del-store
|
||||
-h, --help help for remove-store
|
||||
-i, --interactive Prompt yes/no for each deletion
|
||||
|
|
|
|||
16
testdata/help__del__ok.ct
vendored
16
testdata/help__del__ok.ct
vendored
|
|
@ -1,28 +1,28 @@
|
|||
$ pda help del
|
||||
$ pda del --help
|
||||
$ pda help rm
|
||||
$ pda rm --help
|
||||
Delete one or more keys
|
||||
|
||||
Usage:
|
||||
pda del KEY[@STORE] [KEY[@STORE] ...] [flags]
|
||||
pda remove KEY[@STORE] [KEY[@STORE] ...] [flags]
|
||||
|
||||
Aliases:
|
||||
del, delete, rm, remove
|
||||
remove, rm
|
||||
|
||||
Flags:
|
||||
-g, --glob strings Delete keys matching glob pattern (repeatable)
|
||||
--glob-sep string Characters treated as separators for globbing (default "/-_.@: ")
|
||||
-h, --help help for del
|
||||
-h, --help help for remove
|
||||
-i, --interactive Prompt yes/no for each deletion
|
||||
Delete one or more keys
|
||||
|
||||
Usage:
|
||||
pda del KEY[@STORE] [KEY[@STORE] ...] [flags]
|
||||
pda remove KEY[@STORE] [KEY[@STORE] ...] [flags]
|
||||
|
||||
Aliases:
|
||||
del, delete, rm, remove
|
||||
remove, rm
|
||||
|
||||
Flags:
|
||||
-g, --glob strings Delete keys matching glob pattern (repeatable)
|
||||
--glob-sep string Characters treated as separators for globbing (default "/-_.@: ")
|
||||
-h, --help help for del
|
||||
-h, --help help for remove
|
||||
-i, --interactive Prompt yes/no for each deletion
|
||||
|
|
|
|||
12
testdata/help__dump__ok.ct
vendored
12
testdata/help__dump__ok.ct
vendored
|
|
@ -3,28 +3,28 @@ $ pda dump --help
|
|||
Dump all key/value pairs as NDJSON
|
||||
|
||||
Usage:
|
||||
pda dump [STORE] [flags]
|
||||
pda export [STORE] [flags]
|
||||
|
||||
Aliases:
|
||||
dump, export
|
||||
export, dump
|
||||
|
||||
Flags:
|
||||
-e, --encoding string value encoding: auto, base64, or text (default "auto")
|
||||
-g, --glob strings Filter keys with glob pattern (repeatable)
|
||||
--glob-sep string Characters treated as separators for globbing (default "/-_.@: ")
|
||||
-h, --help help for dump
|
||||
-h, --help help for export
|
||||
--secret Include entries marked as secret
|
||||
Dump all key/value pairs as NDJSON
|
||||
|
||||
Usage:
|
||||
pda dump [STORE] [flags]
|
||||
pda export [STORE] [flags]
|
||||
|
||||
Aliases:
|
||||
dump, export
|
||||
export, dump
|
||||
|
||||
Flags:
|
||||
-e, --encoding string value encoding: auto, base64, or text (default "auto")
|
||||
-g, --glob strings Filter keys with glob pattern (repeatable)
|
||||
--glob-sep string Characters treated as separators for globbing (default "/-_.@: ")
|
||||
-h, --help help for dump
|
||||
-h, --help help for export
|
||||
--secret Include entries marked as secret
|
||||
|
|
|
|||
4
testdata/help__list-dbs__ok.ct
vendored
4
testdata/help__list-dbs__ok.ct
vendored
|
|
@ -6,7 +6,7 @@ Usage:
|
|||
pda list-stores [flags]
|
||||
|
||||
Aliases:
|
||||
list-stores, ls-stores, lsd
|
||||
list-stores, ls-stores, lss
|
||||
|
||||
Flags:
|
||||
-h, --help help for list-stores
|
||||
|
|
@ -16,7 +16,7 @@ Usage:
|
|||
pda list-stores [flags]
|
||||
|
||||
Aliases:
|
||||
list-stores, ls-stores, lsd
|
||||
list-stores, ls-stores, lss
|
||||
|
||||
Flags:
|
||||
-h, --help help for list-stores
|
||||
|
|
|
|||
80
testdata/help__ok.ct
vendored
80
testdata/help__ok.ct
vendored
|
|
@ -12,23 +12,29 @@ $ pda --help
|
|||
Usage:
|
||||
pda [command]
|
||||
|
||||
Available Commands:
|
||||
completion Generate the autocompletion script for the specified shell
|
||||
cp Make a copy of a key
|
||||
del Delete one or more keys
|
||||
del-store Delete a store
|
||||
dump Dump all key/value pairs as NDJSON
|
||||
get Get the value of a key
|
||||
git Run any arbitrary command. Use with caution.
|
||||
help Help about any command
|
||||
init Initialise pda! version control
|
||||
list List the contents of a store
|
||||
list-stores List all stores
|
||||
mv Move a key
|
||||
restore Restore key/value pairs from an NDJSON dump
|
||||
set Set a key to a given value
|
||||
sync Manually sync your stores with Git
|
||||
version Display pda! version
|
||||
Key commands:
|
||||
copy Make a copy of a key
|
||||
get Get the value of a key
|
||||
list List the contents of a store
|
||||
move Move a key
|
||||
remove Delete one or more keys
|
||||
set Set a key to a given value
|
||||
|
||||
Store commands:
|
||||
export Dump all key/value pairs as NDJSON
|
||||
import Restore key/value pairs from an NDJSON dump
|
||||
list-stores List all stores
|
||||
remove-store Delete a store
|
||||
|
||||
Git commands:
|
||||
git Run any arbitrary command. Use with caution.
|
||||
init Initialise pda! version control
|
||||
sync Manually sync your stores with Git
|
||||
|
||||
Additional Commands:
|
||||
completion Generate the autocompletion script for the specified shell
|
||||
help Help about any command
|
||||
version Display pda! version
|
||||
|
||||
Flags:
|
||||
-h, --help help for pda
|
||||
|
|
@ -46,23 +52,29 @@ Use "pda [command] --help" for more information about a command.
|
|||
Usage:
|
||||
pda [command]
|
||||
|
||||
Available Commands:
|
||||
completion Generate the autocompletion script for the specified shell
|
||||
cp Make a copy of a key
|
||||
del Delete one or more keys
|
||||
del-store Delete a store
|
||||
dump Dump all key/value pairs as NDJSON
|
||||
get Get the value of a key
|
||||
git Run any arbitrary command. Use with caution.
|
||||
help Help about any command
|
||||
init Initialise pda! version control
|
||||
list List the contents of a store
|
||||
list-stores List all stores
|
||||
mv Move a key
|
||||
restore Restore key/value pairs from an NDJSON dump
|
||||
set Set a key to a given value
|
||||
sync Manually sync your stores with Git
|
||||
version Display pda! version
|
||||
Key commands:
|
||||
copy Make a copy of a key
|
||||
get Get the value of a key
|
||||
list List the contents of a store
|
||||
move Move a key
|
||||
remove Delete one or more keys
|
||||
set Set a key to a given value
|
||||
|
||||
Store commands:
|
||||
export Dump all key/value pairs as NDJSON
|
||||
import Restore key/value pairs from an NDJSON dump
|
||||
list-stores List all stores
|
||||
remove-store Delete a store
|
||||
|
||||
Git commands:
|
||||
git Run any arbitrary command. Use with caution.
|
||||
init Initialise pda! version control
|
||||
sync Manually sync your stores with Git
|
||||
|
||||
Additional Commands:
|
||||
completion Generate the autocompletion script for the specified shell
|
||||
help Help about any command
|
||||
version Display pda! version
|
||||
|
||||
Flags:
|
||||
-h, --help help for pda
|
||||
|
|
|
|||
12
testdata/help__restore__ok.ct
vendored
12
testdata/help__restore__ok.ct
vendored
|
|
@ -3,28 +3,28 @@ $ pda restore --help
|
|||
Restore key/value pairs from an NDJSON dump
|
||||
|
||||
Usage:
|
||||
pda restore [STORE] [flags]
|
||||
pda import [STORE] [flags]
|
||||
|
||||
Aliases:
|
||||
restore, import
|
||||
import, restore
|
||||
|
||||
Flags:
|
||||
-f, --file string Path to an NDJSON dump (defaults to stdin)
|
||||
-g, --glob strings Restore keys matching glob pattern (repeatable)
|
||||
--glob-sep string Characters treated as separators for globbing (default "/-_.@: ")
|
||||
-h, --help help for restore
|
||||
-h, --help help for import
|
||||
-i, --interactive Prompt before overwriting existing keys
|
||||
Restore key/value pairs from an NDJSON dump
|
||||
|
||||
Usage:
|
||||
pda restore [STORE] [flags]
|
||||
pda import [STORE] [flags]
|
||||
|
||||
Aliases:
|
||||
restore, import
|
||||
import, restore
|
||||
|
||||
Flags:
|
||||
-f, --file string Path to an NDJSON dump (defaults to stdin)
|
||||
-g, --glob strings Restore keys matching glob pattern (repeatable)
|
||||
--glob-sep string Characters treated as separators for globbing (default "/-_.@: ")
|
||||
-h, --help help for restore
|
||||
-h, --help help for import
|
||||
-i, --interactive Prompt before overwriting existing keys
|
||||
|
|
|
|||
2
testdata/restore__glob__ok.ct
vendored
2
testdata/restore__glob__ok.ct
vendored
|
|
@ -2,7 +2,7 @@ $ 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
|
||||
$ pda rm a1 a2 b1
|
||||
$ pda restore --glob a* --file dumpfile
|
||||
Restored 2 entries into @default
|
||||
$ pda get a1
|
||||
|
|
|
|||
40
testdata/root__ok.ct
vendored
40
testdata/root__ok.ct
vendored
|
|
@ -11,23 +11,29 @@ $ pda
|
|||
Usage:
|
||||
pda [command]
|
||||
|
||||
Available Commands:
|
||||
completion Generate the autocompletion script for the specified shell
|
||||
cp Make a copy of a key
|
||||
del Delete one or more keys
|
||||
del-store Delete a store
|
||||
dump Dump all key/value pairs as NDJSON
|
||||
get Get the value of a key
|
||||
git Run any arbitrary command. Use with caution.
|
||||
help Help about any command
|
||||
init Initialise pda! version control
|
||||
list List the contents of a store
|
||||
list-stores List all stores
|
||||
mv Move a key
|
||||
restore Restore key/value pairs from an NDJSON dump
|
||||
set Set a key to a given value
|
||||
sync Manually sync your stores with Git
|
||||
version Display pda! version
|
||||
Key commands:
|
||||
copy Make a copy of a key
|
||||
get Get the value of a key
|
||||
list List the contents of a store
|
||||
move Move a key
|
||||
remove Delete one or more keys
|
||||
set Set a key to a given value
|
||||
|
||||
Store commands:
|
||||
export Dump all key/value pairs as NDJSON
|
||||
import Restore key/value pairs from an NDJSON dump
|
||||
list-stores List all stores
|
||||
remove-store Delete a store
|
||||
|
||||
Git commands:
|
||||
git Run any arbitrary command. Use with caution.
|
||||
init Initialise pda! version control
|
||||
sync Manually sync your stores with Git
|
||||
|
||||
Additional Commands:
|
||||
completion Generate the autocompletion script for the specified shell
|
||||
help Help about any command
|
||||
version Display pda! version
|
||||
|
||||
Flags:
|
||||
-h, --help help for pda
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue