Skip to content

Commit

Permalink
Clean up error output
Browse files Browse the repository at this point in the history
  • Loading branch information
TomWright committed Nov 9, 2021
1 parent 4d7d1c2 commit 298479e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions cmd/dasel/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"fmt"
"github.com/tomwright/dasel/internal/command"
"os"
)
Expand All @@ -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)
}
}
6 changes: 4 additions & 2 deletions internal/command/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 298479e

Please sign in to comment.