Skip to content

Commit 5b0e14d

Browse files
committed
minor: 🚑 Fix flag parsing
1 parent a09500b commit 5b0e14d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hello.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,14 +584,15 @@ type Options struct {
584584
func main() {
585585
var opts Options
586586

587-
args, err := flags.Parse(&opts)
587+
args, err := flags.NewParser(&opts, flags.HelpFlag | flags.PassDoubleDash).Parse()
588588
if opts.ShowVersion {
589589
showVersion()
590590
os.Exit(0)
591591
}
592592

593593
if err != nil {
594-
panic(err)
594+
fmt.Printf("%s", err)
595+
os.Exit(1)
595596
}
596597

597598
fmt.Println(args)

0 commit comments

Comments
 (0)