feat: command rename finalising

This commit is contained in:
Lewis Wynne 2026-02-11 16:13:49 +00:00
parent 8ea865b2ce
commit a4d2e919dc
15 changed files with 22 additions and 33 deletions

View file

@ -35,7 +35,7 @@ import (
var delStoreCmd = &cobra.Command{
Use: "remove-store STORE",
Short: "Delete a store",
Aliases: []string{"rm-store", "rms"},
Aliases: []string{"rms"},
Args: cobra.ExactArgs(1),
RunE: delStore,
SilenceUsage: true,

View file

@ -29,7 +29,7 @@ import (
var exportCmd = &cobra.Command{
Use: "export [STORE]",
Short: "Export store as NDJSON (alias for list --format ndjson)",
Aliases: []string{"dump"},
Aliases: []string{},
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
listFormat = "ndjson"

View file

@ -8,6 +8,7 @@ import (
var identityCmd = &cobra.Command{
Use: "identity",
Aliases: []string{"id"},
Short: "Show or create the age encryption identity",
Args: cobra.NoArgs,
RunE: identityRun,

View file

@ -31,7 +31,7 @@ import (
var listStoresCmd = &cobra.Command{
Use: "list-stores",
Short: "List all stores",
Aliases: []string{"ls-stores", "lss"},
Aliases: []string{"lss"},
Args: cobra.NoArgs,
RunE: listStores,
SilenceUsage: true,

View file

@ -38,7 +38,7 @@ import (
var restoreCmd = &cobra.Command{
Use: "import [STORE]",
Short: "Restore key/value pairs from an NDJSON dump",
Aliases: []string{"restore"},
Aliases: []string{},
Args: cobra.MaximumNArgs(1),
RunE: restore,
SilenceUsage: true,

View file

@ -1,8 +1,8 @@
$ pda set a1 1
$ pda set a2 2
$ pda set b1 3
$ pda dump --key "a*"
$ pda export --key "a*"
{"key":"a1","value":"1","encoding":"text"}
{"key":"a2","value":"2","encoding":"text"}
$ pda dump --key "c*" --> FAIL
$ pda export --key "c*" --> FAIL
FAIL cannot ls '@default': no matches for key pattern 'c*'

View file

@ -2,7 +2,7 @@ $ pda set url https://example.com
$ fecho tmpval hello world
$ pda set greeting < tmpval
$ pda set number 42
$ pda dump --value "**https**"
$ pda export --value "**https**"
{"key":"url","value":"https://example.com","encoding":"text"}
$ pda dump --value "**world**"
$ pda export --value "**world**"
{"key":"greeting","value":"hello world\n","encoding":"text"}

View file

@ -1,13 +1,10 @@
$ pda help dump
$ pda dump --help
$ pda help export
$ pda export --help
Export store as NDJSON (alias for list --format ndjson)
Usage:
pda export [STORE] [flags]
Aliases:
export, dump
Flags:
-h, --help help for export
-k, --key strings Filter keys with glob pattern (repeatable)
@ -17,9 +14,6 @@ Export store as NDJSON (alias for list --format ndjson)
Usage:
pda export [STORE] [flags]
Aliases:
export, dump
Flags:
-h, --help help for export
-k, --key strings Filter keys with glob pattern (repeatable)

View file

@ -6,7 +6,7 @@ Usage:
pda list-stores [flags]
Aliases:
list-stores, ls-stores, lss
list-stores, lss
Flags:
-h, --help help for list-stores
@ -16,7 +16,7 @@ Usage:
pda list-stores [flags]
Aliases:
list-stores, ls-stores, lss
list-stores, lss
Flags:
-h, --help help for list-stores

View file

@ -6,7 +6,7 @@ Usage:
pda remove-store STORE [flags]
Aliases:
remove-store, rm-store, rms
remove-store, rms
Flags:
-h, --help help for remove-store
@ -17,7 +17,7 @@ Usage:
pda remove-store STORE [flags]
Aliases:
remove-store, rm-store, rms
remove-store, rms
Flags:
-h, --help help for remove-store

View file

@ -1,13 +1,10 @@
$ pda help restore
$ pda restore --help
$ pda help import
$ pda import --help
Restore key/value pairs from an NDJSON dump
Usage:
pda import [STORE] [flags]
Aliases:
import, restore
Flags:
--drop Drop existing entries before restoring (full replace)
-f, --file string Path to an NDJSON dump (defaults to stdin)
@ -19,9 +16,6 @@ Restore key/value pairs from an NDJSON dump
Usage:
pda import [STORE] [flags]
Aliases:
import, restore
Flags:
--drop Drop existing entries before restoring (full replace)
-f, --file string Path to an NDJSON dump (defaults to stdin)

View file

@ -1,7 +1,7 @@
$ pda set existing keep-me
$ pda set other also-keep
$ fecho dumpfile {"key":"new","value":"hello","encoding":"text"}
$ pda restore --drop --file dumpfile
$ pda import --drop --file dumpfile
ok restored 1 entries into @default
$ pda get new
hello

View file

@ -3,7 +3,7 @@ $ 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 rm a1 a2 b1
$ pda restore --key "a*" --file dumpfile
$ pda import --key "a*" --file dumpfile
ok restored 2 entries into @default
$ pda get a1
1
@ -12,5 +12,5 @@ $ pda get a2
$ pda get b1 --> FAIL
FAIL cannot get 'b1': no such key
hint did you mean 'a1'?
$ pda restore --key "c*" --file dumpfile --> FAIL
$ pda import --key "c*" --file dumpfile --> FAIL
FAIL cannot restore '@default': no matches for key pattern 'c*'

View file

@ -1,7 +1,7 @@
# Merge import updates existing entries and adds new ones
$ pda set existing@mrg old-value
$ fecho dumpfile {"key":"existing","value":"updated","encoding":"text"} {"key":"new","value":"hello","encoding":"text"}
$ pda restore mrg --file dumpfile
$ pda import mrg --file dumpfile
ok restored 2 entries into @mrg
$ pda get existing@mrg
updated

View file

@ -1,7 +1,7 @@
# Import from stdin preserves existing entries
$ pda set existing@stn keep-me
$ fecho dumpfile {"key":"new","value":"hello","encoding":"text"}
$ pda restore stn < dumpfile
$ pda import stn < dumpfile
ok restored 1 entries into @stn
$ pda get existing@stn
keep-me