mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Merge pull request #337 from Icinga/bugfix/icingadb-help-should-not-display-a-stack-trace-at-the-end-334
Don't print stack on CLI parsing failure or --help
This commit is contained in:
commit
a3875d82d2
1 changed files with 7 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/icinga/icingadb/pkg/icingadb"
|
||||
"github.com/icinga/icingadb/pkg/icingaredis"
|
||||
"github.com/icinga/icingadb/pkg/utils"
|
||||
goflags "github.com/jessevdk/go-flags"
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
"os"
|
||||
|
|
@ -23,7 +24,12 @@ type Command struct {
|
|||
func New() *Command {
|
||||
flags, err := config.ParseFlags()
|
||||
if err != nil {
|
||||
utils.Fatal(err)
|
||||
var cliErr *goflags.Error
|
||||
if errors.As(err, &cliErr) && cliErr.Type == goflags.ErrHelp {
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
if flags.Version {
|
||||
|
|
|
|||
Loading…
Reference in a new issue