init
This commit is contained in:
parent
3bc08d0a96
commit
976d3852fd
9
main.go
9
main.go
@ -94,7 +94,7 @@ func initLog() {
|
||||
}
|
||||
|
||||
func parseArg() {
|
||||
parser := flags.NewParser(&opts, flags.Default)
|
||||
parser := flags.NewParser(&opts, flags.HelpFlag|flags.PassDoubleDash)
|
||||
if _, err := parser.Parse(); err != nil {
|
||||
if opts.Version {
|
||||
printVersion()
|
||||
@ -102,14 +102,17 @@ func parseArg() {
|
||||
}
|
||||
|
||||
if flagsErr, ok := err.(*flags.Error); ok && flagsErr.Type == flags.ErrHelp {
|
||||
_, _ = fmt.Fprintln(os.Stdout, err)
|
||||
os.Exit(0)
|
||||
} else {
|
||||
}
|
||||
|
||||
_, _ = fmt.Fprintln(os.Stderr, err)
|
||||
|
||||
parser.Name = AppName
|
||||
parser.WriteHelp(os.Stderr)
|
||||
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func requestHandle(w http.ResponseWriter, r *http.Request) {
|
||||
|
Loading…
Reference in New Issue
Block a user