chore(cmd): updates Shorts, and test expectations.

This commit is contained in:
Lewis Wynne 2025-12-23 08:42:20 +00:00
parent ef597c5f22
commit 9467675715
16 changed files with 60 additions and 49 deletions

View file

@ -34,7 +34,7 @@ import (
// delDbCmd represents the set command // delDbCmd represents the set command
var delDbCmd = &cobra.Command{ var delDbCmd = &cobra.Command{
Use: "del-db DB", Use: "del-db DB",
Short: "Delete a database.", Short: "Delete a database",
Aliases: []string{"delete-db", "rm-db", "remove-db"}, Aliases: []string{"delete-db", "rm-db", "remove-db"},
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
RunE: delDb, RunE: delDb,

View file

@ -35,7 +35,7 @@ import (
// delCmd represents the set command // delCmd represents the set command
var delCmd = &cobra.Command{ var delCmd = &cobra.Command{
Use: "del KEY[@DB] [KEY[@DB] ...]", Use: "del KEY[@DB] [KEY[@DB] ...]",
Short: "Delete one or more keys. Optionally specify a db.", Short: "Delete one or more keys",
Aliases: []string{"delete", "rm", "remove"}, Aliases: []string{"delete", "rm", "remove"},
Args: cobra.ArbitraryArgs, Args: cobra.ArbitraryArgs,
RunE: del, RunE: del,

View file

@ -39,8 +39,8 @@ import (
// getCmd represents the get command // getCmd represents the get command
var getCmd = &cobra.Command{ var getCmd = &cobra.Command{
Use: "get KEY[@DB]", Use: "get KEY[@DB]",
Short: "Get a value for a key. Optionally specify a db.", Short: "Get the value of a key",
Long: `Get a value for a key. Optionally specify a db. Long: `Get the value of a key. Optionally specify a db.
{{ .TEMPLATES }} can be filled by passing TEMPLATE=VALUE as an {{ .TEMPLATES }} can be filled by passing TEMPLATE=VALUE as an
additional argument after the initial KEY being fetched. additional argument after the initial KEY being fetched.

View file

@ -31,7 +31,12 @@ import (
var gitCmd = &cobra.Command{ var gitCmd = &cobra.Command{
Use: "git [args...]", Use: "git [args...]",
Short: "Run git in the pda VCS repository", Short: "Run any arbitrary command. Use with caution.",
Long: `Run any arbitrary command. Use with caution.
Be wary of how pda! version control operates before using this. Regular data is stored in "PDA_DATA/pda/stores" as a database; the Git repository is in "PDA_DATA/pda/vcs" and contains a replica of the database stored as plaintext.
The regular sync command (or auto-syncing) exports pda! data into plaintext in the Git repository. If you manually modify the repository without using the built-in commands, or exporting your data to the folder in the correct format first, you may desynchronize your repository.`,
Args: cobra.ArbitraryArgs, Args: cobra.ArbitraryArgs,
DisableFlagParsing: true, DisableFlagParsing: true,
SilenceUsage: true, SilenceUsage: true,

View file

@ -33,7 +33,7 @@ import (
var initCmd = &cobra.Command{ var initCmd = &cobra.Command{
Use: "init [remote-url]", Use: "init [remote-url]",
Short: "Initialise (or fetch) Git-backed version control.", Short: "Initialise pda! version control",
SilenceUsage: true, SilenceUsage: true,
Args: cobra.MaximumNArgs(1), Args: cobra.MaximumNArgs(1),
RunE: vcsInit, RunE: vcsInit,

View file

@ -30,7 +30,7 @@ import (
// delCmd represents the set command // delCmd represents the set command
var listDbsCmd = &cobra.Command{ var listDbsCmd = &cobra.Command{
Use: "list-dbs", Use: "list-dbs",
Short: "List all dbs.", Short: "List all databases",
Aliases: []string{"ls-dbs", "lsd"}, Aliases: []string{"ls-dbs", "lsd"},
Args: cobra.NoArgs, Args: cobra.NoArgs,
RunE: listDbs, RunE: listDbs,

View file

@ -33,7 +33,7 @@ import (
var listCmd = &cobra.Command{ var listCmd = &cobra.Command{
Use: "list [DB]", Use: "list [DB]",
Short: "List the contents of a db.", Short: "List the contents of a database",
Aliases: []string{"ls"}, Aliases: []string{"ls"},
Args: cobra.MaximumNArgs(1), Args: cobra.MaximumNArgs(1),
RunE: list, RunE: list,

View file

@ -32,7 +32,7 @@ import (
// rootCmd represents the base command when called without any subcommands // rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{ var rootCmd = &cobra.Command{
Use: "pda", Use: "pda",
Short: "A key-value store.", Short: "A key-value store tool",
Long: asciiArt, Long: asciiArt,
} }

View file

@ -1,6 +1,6 @@
$ pda help del-db $ pda help del-db
$ pda del-db --help $ pda del-db --help
Delete a database. Delete a database
Usage: Usage:
pda del-db DB [flags] pda del-db DB [flags]
@ -11,7 +11,7 @@ Aliases:
Flags: Flags:
-h, --help help for del-db -h, --help help for del-db
-i, --interactive Prompt yes/no for each deletion -i, --interactive Prompt yes/no for each deletion
Delete a database. Delete a database
Usage: Usage:
pda del-db DB [flags] pda del-db DB [flags]

View file

@ -1,6 +1,6 @@
$ pda help del $ pda help del
$ pda del --help $ pda del --help
Delete one or more keys. Optionally specify a db. Delete one or more keys
Usage: Usage:
pda del KEY[@DB] [KEY[@DB] ...] [flags] pda del KEY[@DB] [KEY[@DB] ...] [flags]
@ -13,7 +13,7 @@ Flags:
--glob-sep string Characters treated as separators for globbing (default "/-_.@: ") --glob-sep string Characters treated as separators for globbing (default "/-_.@: ")
-h, --help help for del -h, --help help for del
-i, --interactive Prompt yes/no for each deletion -i, --interactive Prompt yes/no for each deletion
Delete one or more keys. Optionally specify a db. Delete one or more keys
Usage: Usage:
pda del KEY[@DB] [KEY[@DB] ...] [flags] pda del KEY[@DB] [KEY[@DB] ...] [flags]

View file

@ -1,6 +1,6 @@
$ pda help get $ pda help get
$ pda get --help $ pda get --help
Get a value for a key. Optionally specify a db. Get the value of a key. Optionally specify a db.
{{ .TEMPLATES }} can be filled by passing TEMPLATE=VALUE as an {{ .TEMPLATES }} can be filled by passing TEMPLATE=VALUE as an
additional argument after the initial KEY being fetched. additional argument after the initial KEY being fetched.
@ -21,7 +21,7 @@ Flags:
--no-template directly output template syntax --no-template directly output template syntax
-c, --run execute the result as a shell command -c, --run execute the result as a shell command
--secret display values marked as secret --secret display values marked as secret
Get a value for a key. Optionally specify a db. Get the value of a key. Optionally specify a db.
{{ .TEMPLATES }} can be filled by passing TEMPLATE=VALUE as an {{ .TEMPLATES }} can be filled by passing TEMPLATE=VALUE as an
additional argument after the initial KEY being fetched. additional argument after the initial KEY being fetched.

View file

@ -1,6 +1,6 @@
$ pda help list-dbs $ pda help list-dbs
$ pda list-dbs --help $ pda list-dbs --help
List all dbs. List all databases
Usage: Usage:
pda list-dbs [flags] pda list-dbs [flags]
@ -10,7 +10,7 @@ Aliases:
Flags: Flags:
-h, --help help for list-dbs -h, --help help for list-dbs
List all dbs. List all databases
Usage: Usage:
pda list-dbs [flags] pda list-dbs [flags]

View file

@ -1,6 +1,6 @@
$ pda help list $ pda help list
$ pda list --help $ pda list --help
List the contents of a db. List the contents of a database
Usage: Usage:
pda list [DB] [flags] pda list [DB] [flags]
@ -19,7 +19,7 @@ Flags:
--no-values suppress the value column --no-values suppress the value column
-S, --secret display values marked as secret -S, --secret display values marked as secret
-t, --ttl append a TTL column when entries expire -t, --ttl append a TTL column when entries expire
List the contents of a db. List the contents of a database
Usage: Usage:
pda list [DB] [flags] pda list [DB] [flags]

40
testdata/help__ok.ct vendored
View file

@ -14,18 +14,20 @@ Usage:
Available Commands: Available Commands:
completion Generate the autocompletion script for the specified shell completion Generate the autocompletion script for the specified shell
cp Make a copy of a key. cp Make a copy of a key
del Delete one or more keys. Optionally specify a db. del Delete one or more keys
del-db Delete a database. del-db Delete a database
dump Dump all key/value pairs as NDJSON dump Dump all key/value pairs as NDJSON
get Get a value for a key. Optionally specify a db. get Get the value of a key
git Run any arbitrary command. Use with caution.
help Help about any command help Help about any command
list List the contents of a db. init Initialise pda! version control
list-dbs List all dbs. list List the contents of a database
mv Move a key between (or within) databases. list-dbs List all databases
mv Move a key
restore Restore key/value pairs from an NDJSON dump restore Restore key/value pairs from an NDJSON dump
set Set a value for a key by passing VALUE or Stdin. Optionally specify a db. set Set a key to a given value
vcs Version control utilities sync Manually sync your stores with Git
version Display pda! version version Display pda! version
Flags: Flags:
@ -46,18 +48,20 @@ Usage:
Available Commands: Available Commands:
completion Generate the autocompletion script for the specified shell completion Generate the autocompletion script for the specified shell
cp Make a copy of a key. cp Make a copy of a key
del Delete one or more keys. Optionally specify a db. del Delete one or more keys
del-db Delete a database. del-db Delete a database
dump Dump all key/value pairs as NDJSON dump Dump all key/value pairs as NDJSON
get Get a value for a key. Optionally specify a db. get Get the value of a key
git Run any arbitrary command. Use with caution.
help Help about any command help Help about any command
list List the contents of a db. init Initialise pda! version control
list-dbs List all dbs. list List the contents of a database
mv Move a key between (or within) databases. list-dbs List all databases
mv Move a key
restore Restore key/value pairs from an NDJSON dump restore Restore key/value pairs from an NDJSON dump
set Set a value for a key by passing VALUE or Stdin. Optionally specify a db. set Set a key to a given value
vcs Version control utilities sync Manually sync your stores with Git
version Display pda! version version Display pda! version
Flags: Flags:

View file

@ -1,6 +1,6 @@
$ pda help set $ pda help set
$ pda set --help $ pda set --help
Set a value for a key by passing VALUE or Stdin. Optionally specify a db. Set a key to a given value or stdin. Optionally specify a db.
PDA supports parsing Go templates. Actions are delimited with {{ }}. PDA supports parsing Go templates. Actions are delimited with {{ }}.
@ -22,7 +22,7 @@ Flags:
-i, --interactive Prompt before overwriting an existing key -i, --interactive Prompt before overwriting an existing key
--secret Mark the stored value as a secret --secret Mark the stored value as a secret
-t, --ttl duration Expire the key after the provided duration (e.g. 24h, 30m) -t, --ttl duration Expire the key after the provided duration (e.g. 24h, 30m)
Set a value for a key by passing VALUE or Stdin. Optionally specify a db. Set a key to a given value or stdin. Optionally specify a db.
PDA supports parsing Go templates. Actions are delimited with {{ }}. PDA supports parsing Go templates. Actions are delimited with {{ }}.

20
testdata/root__ok.ct vendored
View file

@ -13,18 +13,20 @@ Usage:
Available Commands: Available Commands:
completion Generate the autocompletion script for the specified shell completion Generate the autocompletion script for the specified shell
cp Make a copy of a key. cp Make a copy of a key
del Delete one or more keys. Optionally specify a db. del Delete one or more keys
del-db Delete a database. del-db Delete a database
dump Dump all key/value pairs as NDJSON dump Dump all key/value pairs as NDJSON
get Get a value for a key. Optionally specify a db. get Get the value of a key
git Run any arbitrary command. Use with caution.
help Help about any command help Help about any command
list List the contents of a db. init Initialise pda! version control
list-dbs List all dbs. list List the contents of a database
mv Move a key between (or within) databases. list-dbs List all databases
mv Move a key
restore Restore key/value pairs from an NDJSON dump restore Restore key/value pairs from an NDJSON dump
set Set a value for a key by passing VALUE or Stdin. Optionally specify a db. set Set a key to a given value
vcs Version control utilities sync Manually sync your stores with Git
version Display pda! version version Display pda! version
Flags: Flags: