forked from u2takey/go-annotation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (32 loc) · 859 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"flag"
"github.com/spf13/pflag"
"k8s.io/klog/v2"
"github.com/fourhu/go-annotation/cmd/annotation-gen/args"
"github.com/fourhu/go-annotation/pkg"
)
func main() {
klog.InitFlags(nil)
defer klog.Flush()
genericArgs, customArgs := args.NewDefaults()
// Override defaults.
genericArgs.AddFlags(pflag.CommandLine)
genericArgs.InputDirs = []string{"github.com/fourhu/go-annotation/examples"}
customArgs.AddFlags(pflag.CommandLine)
_ = flag.Set("logtostderr", "true")
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
pflag.Parse()
if err := args.Validate(genericArgs); err != nil {
klog.Fatalf("Error: %v", err)
}
// Run it
if err := genericArgs.Execute(
pkg.NameSystems(),
pkg.DefaultNameSystem(),
pkg.Packages,
); err != nil {
klog.Fatalf("Error: %v", err)
}
klog.V(2).Info("Completed successfully.")
}