Skip to content

Commit

Permalink
fix: Exit program with error code on error
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Oct 19, 2020
1 parent 684ffb1 commit e67ea3d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions nsd/cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
package cmd

import (
"os"

"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
Use: "nsd",
Short: "A simple cli downloader for nodejs, npm and yarn",
Long: "",
Use: "nsd",
Short: "A simple cli downloader for nodejs, npm and yarn",
Long: "",
SilenceUsage: true,
}

// Execute executes the root command.
func Execute() error {
return rootCmd.Execute()
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
return err
}

return nil
}

0 comments on commit e67ea3d

Please # to comment.