-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Exit program with error code on error
- Loading branch information
Showing
1 changed file
with
12 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |