Skip to content
Snippets Groups Projects
Verified Commit fdcc60bf authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: version result always err 1 #5

parent 3957b216
No related branches found
No related tags found
No related merge requests found
......@@ -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)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment