diff --git a/main.go b/main.go index cdb138f..a887551 100644 --- a/main.go +++ b/main.go @@ -1,15 +1,25 @@ package main import ( + "fmt" flag "github.com/spf13/pflag" "log" + "os" ) +const AppVersion = "0.0.11" + func main() { - var configPath *string = flag.StringP("config", "c", "", "config file path") + var configPath *string = flag.StringP("config", "c", "", "specify config file path") + var version *bool = flag.BoolP("version", "v", false, "return tool version and exit") flag.Parse() + if *version { + fmt.Printf("kube-certs-gen, version %s\n", AppVersion) + os.Exit(0) + } + cfg, err := parseConfig(configPath) if err != nil { log.Fatalln(err)