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
var delDbCmd = &cobra.Command{
Use: "del-db DB",
Short: "Delete a database.",
Short: "Delete a database",
Aliases: []string{"delete-db", "rm-db", "remove-db"},
Args: cobra.ExactArgs(1),
RunE: delDb,

View file

@ -35,7 +35,7 @@ import (
// delCmd represents the set command
var delCmd = &cobra.Command{
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"},
Args: cobra.ArbitraryArgs,
RunE: del,

View file

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

View file

@ -31,7 +31,12 @@ import (
var gitCmd = &cobra.Command{
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,
DisableFlagParsing: true,
SilenceUsage: true,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
$ pda help get
$ 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
additional argument after the initial KEY being fetched.
@ -21,7 +21,7 @@ Flags:
--no-template directly output template syntax
-c, --run execute the result as a shell command
--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
additional argument after the initial KEY being fetched.

View file

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

View file

@ -1,6 +1,6 @@
$ pda help list
$ pda list --help
List the contents of a db.
List the contents of a database
Usage:
pda list [DB] [flags]
@ -19,7 +19,7 @@ Flags:
--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.
List the contents of a database
Usage:
pda list [DB] [flags]

40
testdata/help__ok.ct vendored
View file

@ -14,18 +14,20 @@ Usage:
Available Commands:
completion Generate the autocompletion script for the specified shell
cp Make a copy of a key.
del Delete one or more keys. Optionally specify a db.
del-db Delete a database.
cp Make a copy of a key
del Delete one or more keys
del-db Delete a database
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
list List the contents of a db.
list-dbs List all dbs.
mv Move a key between (or within) databases.
init Initialise pda! version control
list List the contents of a database
list-dbs List all databases
mv Move a key
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.
vcs Version control utilities
set Set a key to a given value
sync Manually sync your stores with Git
version Display pda! version
Flags:
@ -46,18 +48,20 @@ Usage:
Available Commands:
completion Generate the autocompletion script for the specified shell
cp Make a copy of a key.
del Delete one or more keys. Optionally specify a db.
del-db Delete a database.
cp Make a copy of a key
del Delete one or more keys
del-db Delete a database
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
list List the contents of a db.
list-dbs List all dbs.
mv Move a key between (or within) databases.
init Initialise pda! version control
list List the contents of a database
list-dbs List all databases
mv Move a key
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.
vcs Version control utilities
set Set a key to a given value
sync Manually sync your stores with Git
version Display pda! version
Flags:

View file

@ -1,6 +1,6 @@
$ pda help set
$ 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 {{ }}.
@ -22,7 +22,7 @@ Flags:
-i, --interactive Prompt before overwriting an existing key
--secret Mark the stored value as a secret
-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 {{ }}.

20
testdata/root__ok.ct vendored
View file

@ -13,18 +13,20 @@ Usage:
Available Commands:
completion Generate the autocompletion script for the specified shell
cp Make a copy of a key.
del Delete one or more keys. Optionally specify a db.
del-db Delete a database.
cp Make a copy of a key
del Delete one or more keys
del-db Delete a database
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
list List the contents of a db.
list-dbs List all dbs.
mv Move a key between (or within) databases.
init Initialise pda! version control
list List the contents of a database
list-dbs List all databases
mv Move a key
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.
vcs Version control utilities
set Set a key to a given value
sync Manually sync your stores with Git
version Display pda! version
Flags: