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
|
|
@ -33,9 +33,9 @@ import (
|
|||
|
||||
// delStoreCmd represents the set command
|
||||
var delStoreCmd = &cobra.Command{
|
||||
Use: "del-store STORE",
|
||||
Use: "remove-store STORE",
|
||||
Short: "Delete a store",
|
||||
Aliases: []string{"delete-store", "rm-store", "remove-store"},
|
||||
Aliases: []string{"rm-store", "rms"},
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: delStore,
|
||||
SilenceUsage: true,
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ import (
|
|||
|
||||
// delCmd represents the set command
|
||||
var delCmd = &cobra.Command{
|
||||
Use: "del KEY[@STORE] [KEY[@STORE] ...]",
|
||||
Use: "remove KEY[@STORE] [KEY[@STORE] ...]",
|
||||
Short: "Delete one or more keys",
|
||||
Aliases: []string{"delete", "rm", "remove"},
|
||||
Aliases: []string{"rm"},
|
||||
Args: cobra.ArbitraryArgs,
|
||||
RunE: del,
|
||||
SilenceUsage: true,
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ type dumpEntry struct {
|
|||
}
|
||||
|
||||
var dumpCmd = &cobra.Command{
|
||||
Use: "dump [STORE]",
|
||||
Use: "export [STORE]",
|
||||
Short: "Dump all key/value pairs as NDJSON",
|
||||
Aliases: []string{"export"},
|
||||
Aliases: []string{"dump"},
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: dump,
|
||||
SilenceUsage: true,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import (
|
|||
var listStoresCmd = &cobra.Command{
|
||||
Use: "list-stores",
|
||||
Short: "List all stores",
|
||||
Aliases: []string{"ls-stores", "lsd"},
|
||||
Aliases: []string{"ls-stores", "lss"},
|
||||
Args: cobra.NoArgs,
|
||||
RunE: listStores,
|
||||
SilenceUsage: true,
|
||||
|
|
|
|||
12
cmd/mv.go
12
cmd/mv.go
|
|
@ -31,14 +31,16 @@ import (
|
|||
)
|
||||
|
||||
var cpCmd = &cobra.Command{
|
||||
Use: "cp FROM[@STORE] TO[@STORE]",
|
||||
Short: "Make a copy of a key",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: cp,
|
||||
Use: "copy FROM[@STORE] TO[@STORE]",
|
||||
Aliases: []string{"cp"},
|
||||
Short: "Make a copy of a key",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: cp,
|
||||
}
|
||||
|
||||
var mvCmd = &cobra.Command{
|
||||
Use: "mv FROM[@STORE] TO[@STORE]",
|
||||
Use: "move FROM[@STORE] TO[@STORE]",
|
||||
Aliases: []string{"mv"},
|
||||
Short: "Move a key",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: mv,
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ import (
|
|||
)
|
||||
|
||||
var restoreCmd = &cobra.Command{
|
||||
Use: "restore [STORE]",
|
||||
Use: "import [STORE]",
|
||||
Short: "Restore key/value pairs from an NDJSON dump",
|
||||
Aliases: []string{"import"},
|
||||
Aliases: []string{"restore"},
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: restore,
|
||||
SilenceUsage: true,
|
||||
|
|
|
|||
24
cmd/root.go
24
cmd/root.go
|
|
@ -47,4 +47,26 @@ func Execute() {
|
|||
}
|
||||
}
|
||||
|
||||
func init() {}
|
||||
func init() {
|
||||
rootCmd.AddGroup(&cobra.Group{ID: "keys", Title: "Key commands:"})
|
||||
|
||||
setCmd.GroupID = "keys"
|
||||
getCmd.GroupID = "keys"
|
||||
mvCmd.GroupID = "keys"
|
||||
cpCmd.GroupID = "keys"
|
||||
delCmd.GroupID = "keys"
|
||||
listCmd.GroupID = "keys"
|
||||
|
||||
rootCmd.AddGroup(&cobra.Group{ID: "stores", Title: "Store commands:"})
|
||||
|
||||
listStoresCmd.GroupID = "stores"
|
||||
delStoreCmd.GroupID = "stores"
|
||||
dumpCmd.GroupID = "stores"
|
||||
restoreCmd.GroupID = "stores"
|
||||
|
||||
rootCmd.AddGroup(&cobra.Group{ID: "git", Title: "Git commands:"})
|
||||
|
||||
initCmd.GroupID = "git"
|
||||
syncCmd.GroupID = "git"
|
||||
gitCmd.GroupID = "git"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue