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
|
// 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,
|
||||||
|
SilenceUsage: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func delDb(cmd *cobra.Command, args []string) error {
|
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{
|
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",
|
||||||
Aliases: []string{"export"},
|
Aliases: []string{"export"},
|
||||||
Args: cobra.MaximumNArgs(1),
|
Args: cobra.MaximumNArgs(1),
|
||||||
RunE: dump,
|
RunE: dump,
|
||||||
|
SilenceUsage: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func dump(cmd *cobra.Command, args []string) error {
|
func dump(cmd *cobra.Command, args []string) error {
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,12 @@ 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 dbs.",
|
||||||
Aliases: []string{"ls-dbs", "lsd"},
|
Aliases: []string{"ls-dbs", "lsd"},
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
RunE: listDbs,
|
RunE: listDbs,
|
||||||
|
SilenceUsage: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func listDbs(cmd *cobra.Command, args []string) error {
|
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{
|
var listCmd = &cobra.Command{
|
||||||
Use: "list [DB]",
|
Use: "list [DB]",
|
||||||
Short: "List the contents of a db.",
|
Short: "List the contents of a db.",
|
||||||
Aliases: []string{"ls"},
|
Aliases: []string{"ls"},
|
||||||
Args: cobra.MaximumNArgs(1),
|
Args: cobra.MaximumNArgs(1),
|
||||||
RunE: list,
|
RunE: list,
|
||||||
|
SilenceUsage: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func list(cmd *cobra.Command, args []string) error {
|
func list(cmd *cobra.Command, args []string) error {
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,12 @@ 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",
|
||||||
Aliases: []string{"import"},
|
Aliases: []string{"import"},
|
||||||
Args: cobra.MaximumNArgs(1),
|
Args: cobra.MaximumNArgs(1),
|
||||||
RunE: restore,
|
RunE: restore,
|
||||||
|
SilenceUsage: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func restore(cmd *cobra.Command, args []string) error {
|
func restore(cmd *cobra.Command, args []string) error {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue