fix cmd behaviour for early exit
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-05-15 11:27:48 +02:00
parent c335867935
commit e06e6f4076
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
3 changed files with 17 additions and 2 deletions

@ -33,3 +33,18 @@ func Execute() {
os.Exit(1)
}
}
// help redefines the original help func, essentially adding a way to exit the
// application properly after showing help message
func help(*cobra.Command, []string) {
err := Root.Usage()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
os.Exit(0)
}
func init() {
Root.SetHelpFunc(help)
}

@ -8,7 +8,7 @@ import (
)
// version holds app version string
var version = "v0.0.12"
var version = "v0.0.13"
// used to determine whether to print short or long version string
var shortVersion = false

@ -21,7 +21,7 @@
# Generate a user-friendly version number.
# version = builtins.substring 0 8 lastModifiedDate;
version = "v0.0.12";
version = "v0.0.13";
# System types to support.
supportedSystems =