Skip to content

Commit

Permalink
cmd: silence errors and usage for cobra commands
Browse files Browse the repository at this point in the history
Closes #623.
Refs #2890.

Signed-off-by: Andrey Butusov <andrey@nspcc.io>
  • Loading branch information
End-rey committed Sep 24, 2024
1 parent 7c9390d commit 0162cb0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
5 changes: 3 additions & 2 deletions cmd/neofs-adm/internal/modules/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ var (
Short: "NeoFS Administrative Tool",
Long: `NeoFS Administrative Tool provides functions to setup and
manage NeoFS network deployment.`,
RunE: entryPoint,
SilenceUsage: true,
RunE: entryPoint,
SilenceUsage: true,
SilenceErrors: true,
}

configFlag = "config"
Expand Down
6 changes: 4 additions & 2 deletions cmd/neofs-cli/modules/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ It contains commands for interaction with NeoFS nodes using different versions
of neofs-api and some useful utilities for compiling ACL rules from JSON
notation, managing container access through protocol gates, querying network map
and much more!`,
Args: cobra.NoArgs,
RunE: entryPoint,
Args: cobra.NoArgs,
RunE: entryPoint,
SilenceErrors: true,
SilenceUsage: true,
}

// Execute adds all child commands to the root command and sets flags appropriately.
Expand Down
11 changes: 6 additions & 5 deletions cmd/neofs-lens/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ import (
)

var command = &cobra.Command{
Use: "neofs-lens",
Short: "NeoFS Storage Engine Lens",
Long: `NeoFS Storage Engine Lens provides tools to browse the contents of the NeoFS storage engine.`,
RunE: entryPoint,
SilenceUsage: true,
Use: "neofs-lens",
Short: "NeoFS Storage Engine Lens",
Long: `NeoFS Storage Engine Lens provides tools to browse the contents of the NeoFS storage engine.`,
RunE: entryPoint,
SilenceUsage: true,
SilenceErrors: true,
}

func entryPoint(cmd *cobra.Command, _ []string) error {
Expand Down

0 comments on commit 0162cb0

Please sign in to comment.