diff --git a/source/commandline.go b/source/commandline.go index 6acbb6256db18c29a285bc2760337419a735ff4f..485847cc3a990115d1cb5eeecf8b1a242caea9fa 100644 --- a/source/commandline.go +++ b/source/commandline.go @@ -31,7 +31,7 @@ type commandLineOptions struct { Date struct { } `command:"date" description:"print the current date and time in the format YYYYMMDDHHMMSS"` Auto struct { - ExitCode bool `short:"e" long:"exit-code-if-no-bump" description:"exit code to use if no notable changes are found" default:"0"` + ExitCode bool `short:"e" long:"exit-code-if-no-bump" description:"exit code to use if no notable changes are found"` } `command:"auto" description:"check the git repository and increase the version if necessary. This implies --git"` Predict struct { } `command:"predict" description:"predict the next version based on the git history. This implies --git"` @@ -86,6 +86,10 @@ func executeCommand() { _, err = p.Parse() if err != nil { + if arguments.Verbose { + fmt.Printf("Error: %s\n", err) + } + os.Exit(1) } @@ -177,14 +181,23 @@ func executeCommand() { case FixCommit: command = "patch" case OtherCommit: - fmt.Println("No notable changes found.") - fmt.Println("If you want to force a version\nincrease, use the major, minor\nor patch command.") exitCode := 0 + printMessage := true if arguments.Auto.ExitCode { + + if !arguments.Verbose { + printMessage = false + } + exitCode = 1 } + if printMessage { + fmt.Println("No notable changes found.") + fmt.Println("If you want to force a version\nincrease, use the major, minor\nor patch command.") + } + os.Exit(exitCode) }