From 6584b2ae0cc4cd2966299913b81ee070f67b009a Mon Sep 17 00:00:00 2001 From: caiweidong Date: Wed, 27 Feb 2019 16:20:12 +0800 Subject: [PATCH] Add flag version --- cmd/hostpathplugin/main.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cmd/hostpathplugin/main.go b/cmd/hostpathplugin/main.go index d4f443f79..258922aaa 100644 --- a/cmd/hostpathplugin/main.go +++ b/cmd/hostpathplugin/main.go @@ -29,14 +29,21 @@ func init() { } var ( - endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint") - driverName = flag.String("drivername", "csi-hostpath", "name of the driver") - nodeID = flag.String("nodeid", "", "node id") + endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint") + driverName = flag.String("drivername", "csi-hostpath", "name of the driver") + nodeID = flag.String("nodeid", "", "node id") + showVersion = flag.Bool("version", false, "Show version.") + version = "" ) func main() { flag.Parse() + if *showVersion { + fmt.Println(os.Args[0], version) + return + } + handle() os.Exit(0) }