diff --git a/cmd/dasel/main.go b/cmd/dasel/main.go index be27602..0369d23 100644 --- a/cmd/dasel/main.go +++ b/cmd/dasel/main.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "github.com/tomwright/dasel/internal/command" "os" ) @@ -10,7 +9,7 @@ func main() { cmd := command.NewRootCMD() command.ChangeDefaultCommand(cmd, "select", "-v", "--version", "help") if err := cmd.Execute(); err != nil { - _, _ = fmt.Fprintln(os.Stderr, "Error: "+err.Error()) + cmd.PrintErrln("Error:", err.Error()) os.Exit(1) } } diff --git a/internal/command/root.go b/internal/command/root.go index f25706d..109b1a3 100644 --- a/internal/command/root.go +++ b/internal/command/root.go @@ -10,8 +10,10 @@ import ( // NewRootCMD returns the root command for use with cobra. func NewRootCMD() *cobra.Command { cmd := &cobra.Command{ - Use: "dasel", - Short: "Query and modify data structures using selector strings.", + Use: "dasel", + Short: "Query and modify data structures using selector strings.", + SilenceErrors: true, + SilenceUsage: true, } cmd.Version = internal.Version cmd.AddCommand(