feat(cmd): SilenceUsage all but root
This commit is contained in:
parent
f6f1376d1a
commit
06e09df829
5 changed files with 30 additions and 25 deletions
|
|
@ -33,11 +33,12 @@ import (
|
|||
|
||||
// delDbCmd represents the set command
|
||||
var delDbCmd = &cobra.Command{
|
||||
Use: "del-db DB",
|
||||
Short: "Delete a database.",
|
||||
Aliases: []string{"delete-db", "rm-db", "remove-db"},
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: delDb,
|
||||
Use: "del-db DB",
|
||||
Short: "Delete a database.",
|
||||
Aliases: []string{"delete-db", "rm-db", "remove-db"},
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: delDb,
|
||||
SilenceUsage: true,
|
||||
}
|
||||
|
||||
func delDb(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
|||
11
cmd/dump.go
11
cmd/dump.go
|
|
@ -20,11 +20,12 @@ type dumpEntry struct {
|
|||
}
|
||||
|
||||
var dumpCmd = &cobra.Command{
|
||||
Use: "dump [DB]",
|
||||
Short: "Dump all key/value pairs as NDJSON",
|
||||
Aliases: []string{"export"},
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: dump,
|
||||
Use: "dump [DB]",
|
||||
Short: "Dump all key/value pairs as NDJSON",
|
||||
Aliases: []string{"export"},
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: dump,
|
||||
SilenceUsage: true,
|
||||
}
|
||||
|
||||
func dump(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
|||
|
|
@ -28,11 +28,12 @@ import (
|
|||
|
||||
// delCmd represents the set command
|
||||
var listDbsCmd = &cobra.Command{
|
||||
Use: "list-dbs",
|
||||
Short: "List all dbs.",
|
||||
Aliases: []string{"ls-dbs", "lsd"},
|
||||
Args: cobra.NoArgs,
|
||||
RunE: listDbs,
|
||||
Use: "list-dbs",
|
||||
Short: "List all dbs.",
|
||||
Aliases: []string{"ls-dbs", "lsd"},
|
||||
Args: cobra.NoArgs,
|
||||
RunE: listDbs,
|
||||
SilenceUsage: true,
|
||||
}
|
||||
|
||||
func listDbs(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
|||
11
cmd/list.go
11
cmd/list.go
|
|
@ -31,11 +31,12 @@ import (
|
|||
)
|
||||
|
||||
var listCmd = &cobra.Command{
|
||||
Use: "list [DB]",
|
||||
Short: "List the contents of a db.",
|
||||
Aliases: []string{"ls"},
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: list,
|
||||
Use: "list [DB]",
|
||||
Short: "List the contents of a db.",
|
||||
Aliases: []string{"ls"},
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: list,
|
||||
SilenceUsage: true,
|
||||
}
|
||||
|
||||
func list(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
|||
|
|
@ -14,11 +14,12 @@ import (
|
|||
)
|
||||
|
||||
var restoreCmd = &cobra.Command{
|
||||
Use: "restore [DB]",
|
||||
Short: "Restore key/value pairs from an NDJSON dump",
|
||||
Aliases: []string{"import"},
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: restore,
|
||||
Use: "restore [DB]",
|
||||
Short: "Restore key/value pairs from an NDJSON dump",
|
||||
Aliases: []string{"import"},
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
RunE: restore,
|
||||
SilenceUsage: true,
|
||||
}
|
||||
|
||||
func restore(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue