feat(cmds): adds common aliases for main commands

This commit is contained in:
Lewis Wynne 2025-11-19 12:41:45 +00:00
parent 885ef5ce4f
commit 28582bc0b2
5 changed files with 25 additions and 20 deletions

View file

@ -32,10 +32,11 @@ import (
// delCmd represents the set command // delCmd represents the set command
var delCmd = &cobra.Command{ var delCmd = &cobra.Command{
Use: "del KEY[@DB]", Use: "del KEY[@DB]",
Short: "Delete a key. Optionally specify a db.", Short: "Delete a key. Optionally specify a db.",
Args: cobra.ExactArgs(1), Aliases: []string{"delete", "rm", "remove"},
RunE: del, Args: cobra.ExactArgs(1),
RunE: del,
} }
func del(cmd *cobra.Command, args []string) error { func del(cmd *cobra.Command, args []string) error {

View file

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

View file

@ -20,10 +20,11 @@ type dumpEntry struct {
} }
var dumpCmd = &cobra.Command{ var dumpCmd = &cobra.Command{
Use: "dump [DB]", Use: "dump [DB]",
Short: "Dump all key/value pairs as NDJSON", Short: "Dump all key/value pairs as NDJSON",
Args: cobra.MaximumNArgs(1), Aliases: []string{"export"},
RunE: dump, Args: cobra.MaximumNArgs(1),
RunE: dump,
} }
func dump(cmd *cobra.Command, args []string) error { func dump(cmd *cobra.Command, args []string) error {

View file

@ -31,10 +31,11 @@ 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 db.",
Args: cobra.MaximumNArgs(1), Aliases: []string{"ls"},
RunE: list, Args: cobra.MaximumNArgs(1),
RunE: list,
} }
func list(cmd *cobra.Command, args []string) error { func list(cmd *cobra.Command, args []string) error {

View file

@ -14,10 +14,11 @@ import (
) )
var restoreCmd = &cobra.Command{ var restoreCmd = &cobra.Command{
Use: "restore [DB]", Use: "restore [DB]",
Short: "Restore key/value pairs from an NDJSON dump", Short: "Restore key/value pairs from an NDJSON dump",
Args: cobra.MaximumNArgs(1), Aliases: []string{"import"},
RunE: restore, Args: cobra.MaximumNArgs(1),
RunE: restore,
} }
func restore(cmd *cobra.Command, args []string) error { func restore(cmd *cobra.Command, args []string) error {