This commit is contained in:
ehlxr 2019-11-15 10:16:19 +08:00
parent 3bc08d0a96
commit 976d3852fd

View File

@ -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) {