We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3743a86 commit 80b6dafCopy full SHA for 80b6daf
main.go
@@ -16,6 +16,7 @@
16
package main
17
18
import (
19
+ "errors"
20
"fmt"
21
"os"
22
"path"
@@ -30,6 +31,8 @@ import (
30
31
)
32
33
func main() {
34
+ flag.CommandLine.Init(os.Args[0], flag.ContinueOnError)
35
+
36
c := &cmd.Config{}
37
c.FromFlags(nil)
38
logLevel := flag.CountP("verbose", "v", "Log more verbosely")
@@ -48,7 +51,12 @@ func main() {
48
51
flag.PrintDefaults()
49
52
}
50
53
- flag.Parse()
54
+ if err := flag.CommandLine.Parse(os.Args[1:]); err != nil {
55
+ if !errors.Is(err, flag.ErrHelp) {
56
+ fmt.Fprintln(os.Stderr, err)
57
+ }
58
+ os.Exit(2)
59
60
61
if *version {
62
fmt.Fprintln(os.Stdout, readVersion())
0 commit comments