refactor: small changes to exit and usage statement

This commit is contained in:
Slug-Boi
2024-10-31 21:32:34 +01:00
parent b1c4df81c8
commit d9431a5e5e
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -56,5 +56,5 @@ var czCmd = &cobra.Command{
func init() { func init() {
rootCmd.AddCommand(czCmd) rootCmd.AddCommand(czCmd)
czCmd.Flags().BoolP("print", "p", false, "Print the commit message") czCmd.Flags().BoolP("print", "p", false, "Print the commit message")
czCmd.Flags().BoolP("cli", "c", false, "Use the cli style syntax to add co-authors") czCmd.Flags().BoolP("cli", "c", false, "[co-author1] [co-author2] ...")
} }
+5
View File
@@ -5,6 +5,7 @@ import (
"io" "io"
"os" "os"
"os/exec" "os/exec"
"strings"
) )
func Cz_Call() string { func Cz_Call() string {
@@ -18,6 +19,10 @@ func Cz_Call() string {
err := cmd.Run() err := cmd.Run()
if err != nil { if err != nil {
// if the user exits the commitizen command, exit the program
if strings.Contains(err.Error(), "exit status 8") {
os.Exit(0)
}
panic(fmt.Sprint(err)) panic(fmt.Sprint(err))
} }