lifted-gen.go add flag parse

Signed-off-by: tanberBro <pengfei.song@daocloud.io>
This commit is contained in:
tanberBro 2022-11-08 19:04:37 +08:00
parent 31f97acae3
commit 825081f900
1 changed files with 7 additions and 3 deletions

View File

@ -13,6 +13,7 @@ import (
"strings" "strings"
"github.com/olekukonko/tablewriter" "github.com/olekukonko/tablewriter"
"github.com/spf13/pflag"
) )
const ( const (
@ -30,13 +31,16 @@ const (
) )
var ( var (
// TODO: add to flag liftedDir = ""
liftedDir = "pkg/util/lifted" output = ""
output = "pkg/util/lifted/doc.go"
excludeFiles = []string{"doc.go"} excludeFiles = []string{"doc.go"}
) )
func main() { func main() {
pflag.StringVar(&liftedDir, "lifted-dir", "pkg/util/lifted", "The path of lifted dir")
pflag.StringVarP(&output, "output", "o", "pkg/util/lifted/doc.go", "The path of lifted-gen output")
pflag.Parse()
a := newAnalyzer() a := newAnalyzer()
a.collect(liftedDir) a.collect(liftedDir)
a.dump(output) a.dump(output)