Fork me on GitHub

go pflag

go pflag

 1 package main
 2 
 3 import (
 4     "fmt"
 5     "github.com/spf13/pflag"
 6 )
 7 
 8 var (
 9     help = pflag.BoolP("help", "h", false, "Show this help message.")
10 )
11 
12 func main() {
13     pflag.Parse()
14     if *help {
15         pflag.Usage()
16         return
17     }
18     fmt.Println(123)
19 }

 

posted @ 2023-12-28 14:26  神雕爱大侠  阅读(8)  评论(0编辑  收藏  举报