diff --git a/internal/base/base.go b/internal/base/base.go index fbc270ad3..1643016f4 100644 --- a/internal/base/base.go +++ b/internal/base/base.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io/ioutil" + "log" "os" "path" "path/filepath" @@ -53,8 +54,7 @@ func Usage() { fmt.Printf("\t%-11s \t%s\n", cmd.Name(), cmd.Short) } } - fmt.Printf("\nUse \"%s help \" for more information about a command.", CmdName) - fmt.Println() + fmt.Printf("\nUse \"%s help \" for more information about a command.\n", CmdName) Exit() } @@ -92,13 +92,12 @@ func getFilePath(filename string) string { func CheckErr(err error) { if err != nil { - fmt.Println(err.Error()) - Exit() + log.Fatalln(err) } } func Exit() { - os.Exit(1) + os.Exit(0) } func AuthInfo(cmd string) string { diff --git a/internal/helper/helper.go b/internal/helper/helper.go index 7947d5922..59cc38816 100644 --- a/internal/helper/helper.go +++ b/internal/helper/helper.go @@ -22,7 +22,8 @@ func runHelper(cmd *base.Command, args []string) { buf.WriteString(base.AuthInfo("helper")) buf.WriteString("\n# Helper\n\n") buf.WriteString("```text\n") - out, _ := exec.Command(base.CmdName).Output() + out, err := exec.Command(base.CmdName).Output() + base.CheckErr(err) buf.Write(out) buf.WriteString("```\n") base.FilePutContents("helper/README.md", buf.Bytes())