-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
39 lines (35 loc) · 1.07 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*******************************************************************************
* Copyright (c) 2022 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Red Hat, Inc.
******************************************************************************/
package main
import (
"flag"
"os"
"github.com/redhat-developer/docker-openshift-analyzer/pkg/cli"
)
func main() {
doaCmd := cli.DockerOpenShiftAnalyzerCommands()
flag.Usage = func() {
_ = doaCmd.Help()
}
// parse the flags but hack around to avoid exiting with error code 2 on help
flag.CommandLine.Init(os.Args[0], flag.ContinueOnError)
args := os.Args[1:]
if err := flag.CommandLine.Parse(args); err != nil {
if err == flag.ErrHelp {
os.Exit(0)
} else {
os.Exit(1)
}
}
if err := doaCmd.Execute(); err != nil {
cli.RedirectErrorStringToStdErrAndExit(err.Error())
}
}