Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag version #18

Merged
merged 1 commit into from
Mar 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions cmd/hostpathplugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"flag"
"fmt"
"os"
"path"

"github.com/kubernetes-csi/csi-driver-host-path/pkg/hostpath"
)
Expand All @@ -29,14 +30,23 @@ 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.")
// Set by the build process
version = ""
)

func main() {
flag.Parse()

if *showVersion {
baseName := path.Base(os.Args[0])
fmt.Println(baseName, version)
return
}

handle()
os.Exit(0)
}
Expand Down