Skip to content

Commit 51b7263

Browse files
committed
Add version flag
1 parent 07bd3f1 commit 51b7263

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,23 @@ func main() {
3737
help := pflag.BoolP("help", "h", false, "Print usage")
3838
exitErr := pflag.BoolP("exit-with-error", "e", false, "Exit with error code if docker.sock found")
3939
verbose := pflag.IntP("verbose", "v", 2, "Logging level")
40+
printVersion := pflag.Bool("version", false, "Print plugin version and exit")
4041

4142
pflag.Parse()
4243

44+
var version = "development"
45+
4346
flag.Set("v", strconv.Itoa(*verbose))
4447
if *help {
4548
pflag.PrintDefaults()
4649
os.Exit(0)
4750
}
4851

52+
if *printVersion {
53+
fmt.Println(version)
54+
os.Exit(0)
55+
}
56+
4957
// initialize tabwriter
5058
w := new(tabwriter.Writer)
5159

0 commit comments

Comments
 (0)