File tree 2 files changed +13
-2
lines changed
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ GO_LINKEROPTS := -ldflags $(GO_LINKERFLAGS)
22
22
GO_FILES = $(shell find . -iname '* .go')
23
23
24
24
build :
25
- go build
25
+ go build $( GO_LINKEROPTS )
26
26
27
27
build-all : $(TARGET_arm6 ) $(TARGET_amd64 ) $(TARGET_386 ) $(TARGET_arm64 ) $(TARGET_riscv64 )
28
28
Original file line number Diff line number Diff line change @@ -52,13 +52,14 @@ func init() {
52
52
53
53
flagSet := rootCmd .Flags ()
54
54
flagSet .Bool ("dump-icinga2-config" , false , "Dump icinga2 config for this plugin" )
55
+
56
+ flagSet .Bool ("version" , false , "Display version and other information about this program" )
55
57
}
56
58
57
59
func RunFunction (cmd * cobra.Command , args []string ) {
58
60
flagSet := cmd .Flags ()
59
61
60
62
dumpConfig , err := flagSet .GetBool ("dump-icinga2-config" )
61
-
62
63
if err != nil {
63
64
check .ExitError (err )
64
65
}
@@ -68,6 +69,16 @@ func RunFunction(cmd *cobra.Command, args []string) {
68
69
os .Exit (check .OK )
69
70
}
70
71
72
+ showVersion , err := flagSet .GetBool ("version" )
73
+ if err != nil {
74
+ check .ExitError (err )
75
+ }
76
+
77
+ if showVersion {
78
+ fmt .Println (cmd .Version )
79
+ os .Exit (check .OK )
80
+ }
81
+
71
82
Help (cmd , args )
72
83
}
73
84
You can’t perform that action at this time.
0 commit comments